Spaces:
Sleeping
Sleeping
Commit ·
d6beeea
1
Parent(s): f1d6968
Added Uvicorn
Browse files
app.py
CHANGED
|
@@ -1308,13 +1308,16 @@ app = gr.mount_gradio_app(api_app, demo, path="/")
|
|
| 1308 |
# Use this block to run the app correctly with Uvicorn
|
| 1309 |
if __name__ == "__main__":
|
| 1310 |
print("Starting server with Uvicorn...")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1311 |
|
| 1312 |
-
|
| 1313 |
-
|
| 1314 |
-
# We have REMOVED demo.launch().
|
| 1315 |
uvicorn.run(
|
| 1316 |
app,
|
| 1317 |
host="0.0.0.0",
|
| 1318 |
port=7860,
|
| 1319 |
-
root_path=
|
| 1320 |
-
)
|
|
|
|
| 1308 |
# Use this block to run the app correctly with Uvicorn
|
| 1309 |
if __name__ == "__main__":
|
| 1310 |
print("Starting server with Uvicorn...")
|
| 1311 |
+
|
| 1312 |
+
# Read the ROOT_PATH from an environment variable.
|
| 1313 |
+
# Default to "/" if the variable is not set (for local testing).
|
| 1314 |
+
root_path = os.getenv("ROOT_PATH", "/")
|
| 1315 |
|
| 1316 |
+
print(f"Using root_path: {root_path}") # Add a log to see what's being used
|
| 1317 |
+
|
|
|
|
| 1318 |
uvicorn.run(
|
| 1319 |
app,
|
| 1320 |
host="0.0.0.0",
|
| 1321 |
port=7860,
|
| 1322 |
+
root_path=root_path # <-- Use the dynamically determined root_path
|
| 1323 |
+
)
|