AmnaHassan commited on
Commit
14abf45
·
verified ·
1 Parent(s): 546528c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import os
3
+
4
+ # This script will run your FastAPI app using uvicorn
5
+ # It's important that uvicorn runs on 0.0.0.0 and the correct port
6
+ # HF Spaces often expose port 7860 for Python apps
7
+ port = os.getenv("PORT", "7860") # Use environment variable if set, otherwise default
8
+ command = f"uvicorn main:app --host 0.0.0.0 --port {port}"
9
+ subprocess.run(command, shell=True)