oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.42k stars 5.3k forks source link

ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost. #5986

Open nanshaws opened 6 months ago

nanshaws commented 6 months ago

Describe the bug

ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.

Is there an existing issue for this?

Reproduction

ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.

Screenshot

截图_20240506142940

Logs

TypeError: replace() argument 1 must be str, not bytes
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ D:\text-generation-webui-main\server.py:255 in <module>                                                             │
│                                                                                                                     │
│   254         # Launch the web UI                                                                                   │
│ > 255         create_interface()                                                                                    │
│   256         while True:                                                                                           │
│                                                                                                                     │
│ D:\text-generation-webui-main\server.py:161 in create_interface                                                     │
│                                                                                                                     │
│   160     with OpenMonkeyPatch():                                                                                   │
│ > 161         shared.gradio['interface'].launch(                                                                    │
│   162             max_threads=64,                                                                                   │
│                                                                                                                     │
│ D:\text-generation-webui-main\installer_files\env\Lib\site-packages\gradio\blocks.py:2305 in launch                 │
│                                                                                                                     │
│   2304         ):                                                                                                   │
│ > 2305             raise ValueError(                                                                                │
│   2306                 "When localhost is not accessible, a shareable link must be created. Ple                     │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your
proxy settings to allow access to localhost.

System Info

Windows10
RTX 3050
i7-11800H
Bedoshady commented 6 months ago

I think this is the same issue. https://github.com/oobabooga/text-generation-webui/issues/5975

Accurio commented 4 months ago

If you use a proxy server in Windows, you may need to set HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables.

import os
from urllib.request import getproxies

proxies = getproxies()
os.environ["http_proxy"]  = proxies["http"]
os.environ["https_proxy"] = proxies["https"]
os.environ["no_proxy"]    = "localhost, 127.0.0.1/8, ::1"
nanshaws commented 3 months ago

If you use a proxy server in Windows, you may need to set HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables.

import os
from urllib.request import getproxies

proxies = getproxies()
os.environ["http_proxy"]  = proxies["http"]
os.environ["https_proxy"] = proxies["https"]
os.environ["no_proxy"]    = "localhost, 127.0.0.1/8, ::1"

you are right