Hunyuan3D-2 icon indicating copy to clipboard operation
Hunyuan3D-2 copied to clipboard

fix: remove redundant "/" in Gradio mount path to prevent double slash in URL

Open clifford402 opened this issue 5 months ago • 1 comments

Description

This PR fixes the issue where accessing the app resulted in URLs like (double slash), which caused front-end errors.
The fix is to set the path argument in gr.mount_gradio_app to an empty string ("") instead of "/".
This ensures all URLs are generated correctly with a single slash.


Code Diff

# ...existing code...
-    app = gr.mount_gradio_app(app, demo, path="/")
+    app = gr.mount_gradio_app(app, demo, path="")
# ...existing code...

After merging this PR, the app will no longer generate URLs with double slashes, and the front-end will work as expected.

clifford402 avatar Jul 06 '25 15:07 clifford402

It works! I did it online with the following command in the console:

sed -i 's|app = gr.mount_gradio_app(app, demo, path="/")|app = gr.mount_gradio_app(app, demo, path="")|' gradio_app.py

Make sure you run it in the right folder containing the gradio_app.py file:

root@9127afe2bc15:/app/Hunyuan3D-2# ls -al total 224 drwxr-xr-x 1 root root 4096 Aug 19 07:59 . drwxr-xr-x 1 root root 4096 Aug 18 14:58 .. drwxr-xr-x 8 root root 4096 Aug 18 14:58 .git -rw-r--r-- 1 root root 3441 Aug 18 14:58 .gitignore -rw-r--r-- 1 root root 596 Aug 18 14:58 .readthedocs.yaml -rw-r--r-- 1 root root 16993 Aug 18 14:58 LICENSE -rw-r--r-- 1 root root 32065 Aug 18 14:58 NOTICE -rw-r--r-- 1 root root 18798 Aug 18 14:58 README.md -rw-r--r-- 1 root root 10231 Aug 18 14:58 README_ja_jp.md -rw-r--r-- 1 root root 11719 Aug 18 14:58 README_zh_cn.md -rw-r--r-- 1 root root 11066 Aug 18 14:58 api_server.py drwxr-xr-x 8 root root 4096 Aug 18 14:58 assets -rw-r--r-- 1 root root 13508 Aug 18 14:58 blender_addon.py drwxr-xr-x 3 root root 4096 Aug 18 14:58 docs drwxr-xr-x 2 root root 4096 Aug 18 14:58 examples -rwxr-xr-x 1 root root 30987 Aug 19 07:59 gradio_app.py drwxr-xr-x 5 root root 4096 Aug 19 08:26 gradio_cache drwxr-xr-x 1 root root 4096 Aug 19 07:39 hy3dgen -rw-r--r-- 1 root root 1555 Aug 18 14:58 minimal_demo.py -rw-r--r-- 1 root root 805 Aug 18 14:58 minimal_vae_demo.py -rw-r--r-- 1 root root 387 Aug 18 14:58 requirements.txt -rw-r--r-- 1 root root 1625 Aug 18 14:58 setup.py root@9127afe2bc15:/app/Hunyuan3D-2#

HenkieTenkie62 avatar Aug 19 '25 08:08 HenkieTenkie62