ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True.

Author: xiaoxstzCreated Mar 20, 2023Updated May 7, 2025

Description

I followed the instruction in the readme file. But I came across the issue below. How to solve it?

txt
(visgpt) λ python visual_chatgpt.py --load ImageCaptioning_cpu,Text2Image_cpu
Initializing VisualChatGPT, load_dict={'ImageCaptioning': 'cpu', 'Text2Image': 'cpu'}
Initializing ImageCaptioning to cpu
Initializing Text2Image to cpu
text_encoder\model.safetensors not found
Fetching 15 files: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 15/15 [00:00<00:00, 110183.12it/s]
C:\Users\tanzi\.conda\envs\visgpt\lib\site-packages\transformers\models\clip\feature_extraction_clip.py:28: FutureWarning: The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use CLIPImageProcessor instead.
  warnings.warn(
`text_config_dict` is provided which will be used to initialize `CLIPTextConfig`. The value `text_config["id2label"]` will be overriden.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ D:\Desktop\Projects\AI\visual-chatgpt\visual_chatgpt.py:903 in <module>                          │
│                                                                                                  │
│   900 │   │   clear.click(bot.memory.clear)                                                      │
│   901 │   │   clear.click(lambda: [], None, chatbot)                                             │
│   902 │   │   clear.click(lambda: [], None, state)                                               │
│ ❱ 903 │   │   demo.launch(server_name="localhost", server_port=8090)                             │
│   904                                                                                            │
│                                                                                                  │
│ C:\Users\tanzi\.conda\envs\visgpt\lib\site-packages\gradio\blocks.py:1460 in launch              │
│                                                                                                  │
│   1457 │   │   # If running in a colab or not able to access localhost,                          │
│   1458 │   │   # a shareable link must be created.                                               │
│   1459 │   │   if _frontend and (not networking.url_ok(self.local_url)) and (not self.share):    │
│ ❱ 1460 │   │   │   raise ValueError(                                                             │
│   1461 │   │   │   │   "When localhost is not accessible, a shareable link must be created. Ple  │
│   1462 │   │   │   )                                                                             │
│   1463                                                                                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True.

Environment

  • Python: 3.8
  • OS: Windows 10
  • pip list
txt
Package                 Version
----------------------- ---------------
absl-py                 1.4.0
accelerate              0.17.1
addict                  2.4.0
aiofiles                23.1.0
aiohttp                 3.8.4
aiosignal               1.3.1
albumentations          1.3.0
altair                  4.2.2
antlr4-python3-runtime  4.9.3
anyio                   3.6.2
async-timeout           4.0.2
attrs                   22.2.0
backports.zoneinfo      0.2.1
basicsr                 1.4.2
blinker                 1.5
braceexpand             0.1.7
cachetools              5.3.0
certifi                 2022.12.7
charset-normalizer      3.1.0
click                   8.1.3
colorama                0.4.6
coloredlogs             15.0.1
contourpy               1.0.7
controlnet-aux          0.0.1
cycler                  0.11.0
dataclasses-json        0.5.7
decorator               5.1.1
diffusers               0.14.0
einops                  0.6.0
entrypoints             0.4
fastapi                 0.95.0
ffmpy                   0.3.0
filelock                3.10.0
flatbuffers             23.3.3
fonttools               4.39.2
frozenlist              1.3.3
fsspec                  2023.3.0
ftfy                    6.1.1
future                  0.18.3
gitdb                   4.0.10
GitPython               3.1.31
google-auth             2.16.2
google-auth-oauthlib    0.4.6
gradio                  3.20.1
greenlet                2.0.2
grpcio                  1.51.3
h11                     0.14.0
httpcore                0.16.3
httpx                   0.23.3
huggingface-hub         0.13.2
humanfriendly           10.0
idna                    3.4
imageio                 2.26.0
imageio-ffmpeg          0.4.8
importlib-metadata      6.1.0
importlib-resources     5.12.0
invisible-watermark     0.1.5
Jinja2                  3.1.2
joblib                  1.2.0
jsonschema              4.17.3
kiwisolver              1.4.4
kornia                  0.6.10
langchain               0.0.101
lazy_loader             0.1
linkify-it-py           2.0.0
lmdb                    1.4.0
Markdown                3.4.1
markdown-it-py          2.2.0
MarkupSafe              2.1.2
marshmallow             3.19.0
marshmallow-enum        1.5.1
matplotlib              3.7.1
mdit-py-plugins         0.3.3
mdurl                   0.1.2
mpmath                  1.3.0
multidict               6.0.4
mypy-extensions         1.0.0
networkx                3.0
numpy                   1.24.2
oauthlib                3.2.2
omegaconf               2.3.0
onnx                    1.13.1
onnxruntime             1.14.1
open-clip-torch         2.16.0
openai                  0.27.2
opencv-python           4.7.0.72
opencv-python-headless  4.7.0.72
orjson                  3.8.7
packaging               23.0
pandas                  1.5.3
Pillow                  9.4.0
pip                     23.0.1
pkgutil_resolve_name    1.3.10
prettytable             3.6.0
protobuf                3.20.3
psutil                  5.9.4
pyarrow                 11.0.0
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pycryptodome            3.17
pydantic                1.10.6
pydeck                  0.8.0
pydub                   0.25.1
Pygments                2.14.0
Pympler                 1.0.1
pyparsing               3.0.9
pyreadline3             3.4.1
pyrsistent              0.19.3
python-dateutil         2.8.2
python-multipart        0.0.6
pytz                    2022.7.1
pytz-deprecation-shim   0.1.0.post0
PyWavelets              1.4.1
PyYAML                  6.0
qudida                  0.0.4
regex                   2022.10.31
requests                2.28.2
requests-oauthlib       1.3.1
rfc3986                 1.5.0
rich                    13.3.2
rsa                     4.9
safetensors             0.3.0
scikit-image            0.20.0
scikit-learn            1.2.2
scipy                   1.9.1
semver                  2.13.0
sentencepiece           0.1.97
setuptools              65.6.3
six                     1.16.0
smmap                   5.0.0
sniffio                 1.3.0
socksio                 1.0.0
SQLAlchemy              1.4.47
starlette               0.26.1
streamlit               1.20.0
sympy                   1.11.1
tb-nightly              2.13.0a20230317
tenacity                8.2.2
tensorboard             2.12.0
tensorboard-data-server 0.7.0
tensorboard-plugin-wit  1.8.1
test-tube               0.7.5
threadpoolctl           3.1.0
tifffile                2023.3.15
timm                    0.6.12
tokenizers              0.13.2
toml                    0.10.2
toolz                   0.12.0
torch                   1.12.1
torchmetrics            0.11.4
torchvision             0.13.1
tornado                 6.2
tqdm                    4.65.0
transformers            4.27.1
typing_extensions       4.5.0
typing-inspect          0.8.0
tzdata                  2022.7
tzlocal                 4.3
uc-micro-py             1.0.1
urllib3                 1.26.15
uvicorn                 0.21.1
validators              0.20.0
watchdog                2.3.1
wcwidth                 0.2.6
webdataset              0.2.43
websockets              10.4
Werkzeug                2.2.3
wheel                   0.38.4
wincertstore            0.2
yapf                    0.32.0
yarl                    1.8.2
zipp                    3.15.0