Spaces:
Sleeping
Sleeping
Improve Uvicorn server configuration for local and HF Spaces
Browse files
app.py
CHANGED
@@ -1,7 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
import time
|
6 |
print(f"Starting up: {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
7 |
|
@@ -724,6 +720,8 @@ else:
|
|
724 |
# Run both servers
|
725 |
if __name__ == "__main__":
|
726 |
if is_running_in_hf_space():
|
727 |
-
|
728 |
os.environ["GRADIO_SSR_MODE"] = "True"
|
729 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import time
|
2 |
print(f"Starting up: {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
3 |
|
|
|
720 |
# Run both servers
|
721 |
if __name__ == "__main__":
|
722 |
if is_running_in_hf_space():
|
723 |
+
# For HF Spaces, use SSR mode
|
724 |
os.environ["GRADIO_SSR_MODE"] = "True"
|
725 |
+
uvicorn.run("app:app", host="0.0.0.0", port=7860)
|
726 |
+
else:
|
727 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|