When loading gr.ChatInterface Space with gr.load, an error occurs in the called Space.
For example, if you load this Space
import gradio as gr
def fn(message, history):
return message
gr.ChatInterface(fn=fn).launch()
with gr.load like this
import gradio as gr
gr.load("hysts-debug/sample-chat", src="spaces").launch()
the Space can be loaded, but the Space raises the following error when you run it:
To create a public link, set `share=True` in `launch()`.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 992, in predict
output = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2019, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1566, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 943, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 865, in wrapper
response = f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/gradio_client/client.py", line 1133, in _inner
predictions = _predict(*data)
File "/usr/local/lib/python3.10/site-packages/gradio_client/client.py", line 1245, in _predict
raise AppError(
gradio_client.exceptions.AppError: The upstream Gradio app has raised an exception but has not enabled verbose error reporting. To enable, set show_error=True in launch().
and you get the following error in the log of the called Space:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 624, in process_events
response = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2019, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1564, in call_function
prediction = await fn(*processed_input)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 832, in async_wrapper
response = await f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/gradio/chat_interface.py", line 616, in _display_input
history.append([message, None]) # type: ignore
AttributeError: 'NoneType' object has no attribute 'append'
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 624, in process_events
response = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2019, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1564, in call_function
prediction = await fn(*processed_input)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 832, in async_wrapper
response = await f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/gradio/chat_interface.py", line 664, in _submit_fn
message_serialized, history = self._process_msg_and_trim_history(
File "/usr/local/lib/python3.10/site-packages/gradio/chat_interface.py", line 641, in _process_msg_and_trim_history
history = history_with_input[:-1]
TypeError: 'NoneType' object is not subscriptable
Describe the bug
When loading
gr.ChatInterface
Space withgr.load
, an error occurs in the called Space.For example, if you load this Space
with
gr.load
like thisthe Space can be loaded, but the Space raises the following error when you run it:
and you get the following error in the log of the called Space:
Have you searched existing issues? š
Reproduction
https://huggingface.co/spaces/hysts-debug/load-chatinterface https://huggingface.co/spaces/hysts-debug/sample-chat
Screenshot
No response
Logs
No response
System Info
Severity
I can work around it