gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
34.22k stars 2.6k forks source link

httpx.ConnectError: [Errno -2] Name or service not known #9285

Open songyu2022 opened 2 months ago

songyu2022 commented 2 months ago

Describe the bug

image this is my gradio version. This error occurs whenever I launch the Gradio app. What should I do? image

Have you searched existing issues? 🔎

Reproduction

import gradio as gr

# 定义简单的函数,返回用户输入的文本
def echo_text(input_text):
    return f'You entered: {input_text}'

# 创建 Gradio 界面
demo = gr.Interface(fn=echo_text,  # 绑定的函数
                    inputs="text",  # 输入类型:文本
                    outputs="text",  # 输出类型:文本
                    title="Simple Gradio Webpage,you did it. come on,come on",  # 网页标题
                    description="damn it")  # 网页描述

# 启动 Gradio 应用
demo.launch(server_name="0.0.0.0", server_port=5576,share=False)

python demo1.py

Screenshot

image

Logs

Traceback (most recent call last):
  File "demo1.py", line 15, in <module>
    demo.launch(server_name="0.0.0.0", server_port=5576,share=False)
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/gradio/blocks.py", line 2405, in launch
    httpx.get(
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_api.py", line 210, in get
    return request(
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_api.py", line 118, in request
    return client.request(
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_client.py", line 837, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_client.py", line 926, in send
    response = self._send_handling_auth(
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_client.py", line 954, in _send_handling_auth
    response = self._send_handling_redirects(
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_client.py", line 991, in _send_handling_redirects
    response = self._send_single_request(request)
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_client.py", line 1027, in _send_single_request
    response = transport.handle_request(request)
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_transports/default.py", line 236, in handle_request
    resp = self._pool.handle_request(req)
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/data/songyu/software/miniconda3/miniconda3/envs/GIGN/lib/python3.8/site-packages/httpx/_transports/default.py", line 89, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [Errno -2] Name or service not known

System Info

# Name                    Version                   Build  Channel
gradio                    4.43.0                   pypi_0    pypi
gradio-client             1.3.0                    pypi_0    pypi

Severity

I can work around it

freddyaboulton commented 2 months ago

What if you remove server_name from launch?