Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -81,8 +81,16 @@ os.environ["GRADIO_ROOT_PATH"] = "https://m7n-zero-gpu-uvicorn-ssr-example.hf.sp
|
|
81 |
|
82 |
# Mount Gradio app to FastAPI with SSR mode for Spaces
|
83 |
app = gr.mount_gradio_app(app, demo, path="/", ssr_mode=True)
|
84 |
-
app.mount("/_app/immutable/assets", StaticFiles(directory="assets"), name="immutable_assets")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
|
|
86 |
# Run server
|
87 |
if __name__ == "__main__":
|
88 |
# Set SSR mode for Spaces
|
|
|
81 |
|
82 |
# Mount Gradio app to FastAPI with SSR mode for Spaces
|
83 |
app = gr.mount_gradio_app(app, demo, path="/", ssr_mode=True)
|
84 |
+
#app.mount("/_app/immutable/assets", StaticFiles(directory="assets"), name="immutable_assets")
|
85 |
+
|
86 |
+
|
87 |
+
from pathlib import Path
|
88 |
+
|
89 |
+
assets_dir = Path("./assets")
|
90 |
+
if not assets_dir.exists():
|
91 |
+
assets_dir.mkdir(parents=True, exist_ok=True) # Create the folder if it doesn't exist
|
92 |
|
93 |
+
app.mount("/_app/immutable/assets", StaticFiles(directory=str(assets_dir)), name="immutable_assets")
|
94 |
# Run server
|
95 |
if __name__ == "__main__":
|
96 |
# Set SSR mode for Spaces
|