New gradio space: connection errored out
I’m creating a new Gradio space with the sample app.py, but immediately got the “Connection errored out” error after build. Below are the sample app.py that I’m running on the space and the error message (sorry for the long error message). The same error appeared on another of my Gradio space that only got this issue after it was rebuilt. Am I missing something? Thanks a bunch!app.py:import gradio as grdef greet(name):return "Hello " + name + “!!”demo = gr.Interface(fn=greet, inputs=“text”, outputs=“text”)demo.launch()Error:Running on local URL:http://0.0.0.0:7860To create a public link, setshare=Trueinlaunch().ERROR:    Exception in ASGI applicationTraceback (most recent call last):File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 279, in _init_core_attrsself._core_schema = _getattr_no_parents(self._type, ‘pydantic_core_schema’)File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 121, in _getattr_no_parentsraise AttributeError(attribute)AttributeError:pydantic_core_schemaDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File “/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py”, line 406, in run_asgiresult = await app(  # type: ignore[func-returns-value]File “/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py”, line 70, incallreturn await self.app(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/fastapi/applications.py”, line 1054, incallawait super().call(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/applications.py”, line 113, incallawait self.middleware_stack(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py”, line 187, incallraise excFile “/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py”, line 165, incallawait self.app(scope, receive, _send)File “/usr/local/lib/python3.10/site-packages/gradio/route_utils.py”, line 766, incallawait self.simple_response(scope, receive, send, request_headers=headers)File “/usr/local/lib/python3.10/site-packages/gradio/route_utils.py”, line 782, in simple_responseawait self.app(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py”, line 62, incallawait wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py”, line 62, in wrapped_appraise excFile “/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py”, line 51, in wrapped_appawait app(scope, receive, sender)File “/usr/local/lib/python3.10/site-packages/starlette/routing.py”, line 715, incallawait self.middleware_stack(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/routing.py”, line 735, in appawait route.handle(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/routing.py”, line 288, in handleawait self.app(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/routing.py”, line 76, in appawait wrap_app_handling_exceptions(app, request)(scope, receive, send)File “/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py”, line 62, in wrapped_appraise excFile "/usr/local/lib/python3.10/site-packages/starlette/exception_handler.py", line 51, in wrapped_appawait app(scope, receive, sender)File “/usr/local/lib/python3.10/site-packages/starlette/routing.py”, line 73, in appresponse = await f(request)File “/usr/local/lib/python3.10/site-packages/fastapi/routing.py”, line 291, in appsolved_result = await solve_dependencies(File “/usr/local/lib/python3.10/site-packages/fastapi/dependencies/utils.py”, line 639, in solve_dependencies) = await request_body_to_args(  # body_params checked aboveFile “/usr/local/lib/python3.10/site-packages/fastapi/dependencies/utils.py”, line 810, in request_body_to_argsfields_to_extract = get_model_fields(first_field.type)File “/usr/local/lib/python3.10/site-packages/fastapi/_compat.py”, line 283, in get_model_fieldsreturn [File “/usr/local/lib/python3.10/site-packages/fastapi/_compat.py”, line 284, inModelField(field_info=field_info, name=name)File “”, line 6, ininitFile “/usr/local/lib/python3.10/site-packages/fastapi/_compat.py”, line 109, inpost_initself._type_adapter: TypeAdapter[Any] = TypeAdapter(File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 266, ininitself._init_core_attrs(rebuild_mocks=False)File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 144, in wrappedreturn func(self, *args, **kwargs)File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 286, in _init_core_attrsself._core_schema = _get_schema(self._type, config_wrapper, parent_depth=self._parent_depth)File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 104, inget_schemaschema = gen.generate_schema(type)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 655, in generate_schemaschema = self._generate_schema_inner(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 908, in _generate_schema_innerreturn self._annotated_schema(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 2025, in _annotated_schemaschema = self._apply_annotations(source_type, annotations)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 2104, in _apply_annotationsschema = get_inner_schema(source_type)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_schema_generation_shared.py”, line 83, incallschema = self._handler(source_type)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 2186, in new_handlerschema = metadata_get_schema(source, get_inner_schema)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 2182, inlambda source, handler: handler(source)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_schema_generation_shared.py”, line 83, incallschema = self._handler(source_type)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 2085, in inner_handlerschema = self._generate_schema_inner(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 929, in _generate_schema_innerreturn self.match_type(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 1029, in match_typereturn self._match_generic_type(obj, origin)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 1058, in _match_generic_typereturn self._union_schema(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 1378, in _union_schemachoices.append(self.generate_schema(arg))File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 655, in generate_schemaschema = self._generate_schema_inner(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 929, in _generate_schema_innerreturn self.match_type(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 1038, in match_typereturn self._unknown_type_schema(obj)File “/usr/local/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py”, line 558, in _unknown_type_schemaraise PydanticSchemaGenerationError(pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class ‘starlette.requests.Request’>. Setarbitrary_types_allowed=Truein the model_config to ignore this error or implement__get_pydantic_core_schema__on your type to fully support it.If you got this error by calling handler() within__get_pydantic_core_schema__then you likely need to callhandler.generate_schema(<some type>)since we do not call__get_pydantic_core_schema__on<some type>otherwise to avoid infinite recursion.For further information visitRedirecting...ERROR:    Exception in ASGI applicationTraceback (most recent call last):File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 279, in _init_core_attrsself._core_schema = _getattr_no_parents(self._type, ‘pydantic_core_schema’)File “/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py”, line 121, in _getattr_no_parentsraise AttributeError(attribute)AttributeError:pydantic_core_schema
2024-09-05T22:36:37Z
Probably same here.Huggingface space failed after working initiallySpacesIt was working before, but then it stopped working suddenly. After factory reboot, it still fails. 

The front end shows “Connection errored out.” 
error log: 

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py", line 279, in _init_core_attrs
    self._core_schema = _getattr_no_parents(self._type, '__pydantic_core_schema__')
  File "/usr/local/lib/python3.10/site-packages/pydantic/type_adapter.py", line 121, in _getattr_no_parents
    rai…Run time error for huggingface spaceSpacesHi, I’m trying to deploy a gradio image recognition app on huggingface space. After the app starts building, it works, but after a while, there is a run time error, and the error message in the “see logs” says, 
“Running on local URL:http://localhost:7860/*** Failed to connect to ec2.gradio.app:22: [Errno 110] Connection timed out” 
I have no idea why it is the case and why it is running on local url instead of the public space. The app only works if I restart the space or edit a file. 
One …
2024-09-06T00:43:43Z
Thanks! Looks like it’s HF issue. Hope it will be resolved soon.
2024-09-06T01:06:31Z
Setting fastapi==0.112.2 in requirements has helped me as a temporary fix.
2024-09-06T02:30:59Z
Awesome! That fixed it. Thanks a lot!
2024-09-07T06:48:56Z
Tysm sir!That helped me so much
2024-09-08T11:36:05Z
can u tell me where should i write the code?
2024-09-08T11:37:17Z
where should i write the code?pls tell me detail
2024-09-08T12:02:39Z
requirements.txtor upgrade Gradio to 4.43.0.
2024-09-08T13:09:37Z
ok thanks alot dude
2024-10-03T20:02:00Z
Worked for me as well, thanks:)
2024-12-16T02:08:39Z
I just hit this problem as well, using Gradio 5.8.0. Installingfastapi=0.112.2still fixed the issue, but downgraded Gradio to 5.1.0.