Owadokun Tosin Tobi commited on
Create run.py
Browse files
run.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uvicorn
|
| 2 |
+
import os
|
| 3 |
+
import logging
|
| 4 |
+
|
| 5 |
+
# Configure production logging
|
| 6 |
+
logging.basicConfig(level=logging.INFO)
|
| 7 |
+
logger = logging.getLogger("Structura")
|
| 8 |
+
|
| 9 |
+
if __name__ == "__main__":
|
| 10 |
+
# Hugging Face expects Port 7860. Render expects $PORT.
|
| 11 |
+
port = int(os.getenv("PORT", 7860))
|
| 12 |
+
|
| 13 |
+
logger.info(f"🚀 Structura System Starting on Port {port}...")
|
| 14 |
+
|
| 15 |
+
# We import the app string to allow workers to load it dynamically
|
| 16 |
+
uvicorn.run(
|
| 17 |
+
"app.main:app",
|
| 18 |
+
host="0.0.0.0",
|
| 19 |
+
port=port,
|
| 20 |
+
reload=False, # Set to True for local dev
|
| 21 |
+
log_level="info"
|
| 22 |
+
)
|