Upload folder using huggingface_hub
Browse files- src/app.py +4 -3
src/app.py
CHANGED
|
@@ -145,10 +145,12 @@ def run_local():
|
|
| 145 |
"""Run local server with uvicorn (for direct execution)"""
|
| 146 |
app = main()
|
| 147 |
if app:
|
|
|
|
|
|
|
| 148 |
uvicorn.run(
|
| 149 |
app,
|
| 150 |
host="0.0.0.0",
|
| 151 |
-
port=
|
| 152 |
reload=False
|
| 153 |
)
|
| 154 |
|
|
@@ -162,8 +164,7 @@ def get_app():
|
|
| 162 |
return main()
|
| 163 |
|
| 164 |
# Create app for HF Spaces when imported
|
| 165 |
-
|
| 166 |
-
app = get_app()
|
| 167 |
|
| 168 |
if __name__ == "__main__":
|
| 169 |
run_local()
|
|
|
|
| 145 |
"""Run local server with uvicorn (for direct execution)"""
|
| 146 |
app = main()
|
| 147 |
if app:
|
| 148 |
+
# Use port 7860 for HF Spaces compatibility, 8000 for local
|
| 149 |
+
port = int(os.environ.get("PORT", 7860)) # HF Spaces uses port 7860
|
| 150 |
uvicorn.run(
|
| 151 |
app,
|
| 152 |
host="0.0.0.0",
|
| 153 |
+
port=port,
|
| 154 |
reload=False
|
| 155 |
)
|
| 156 |
|
|
|
|
| 164 |
return main()
|
| 165 |
|
| 166 |
# Create app for HF Spaces when imported
|
| 167 |
+
app = get_app() # Always create app for HF Spaces
|
|
|
|
| 168 |
|
| 169 |
if __name__ == "__main__":
|
| 170 |
run_local()
|