Spaces:
Sleeping
Sleeping
File size: 489 Bytes
66712c7 40685b6 66712c7 40685b6 f8e356e 66712c7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import subprocess
import sys
def run_uvicorn():
# Command to run the FastAPI app with uvicorn
command = [
"uvicorn",
"main:app",
"--host", "0.0.0.0",
"--port", "7860",
"--reload"
]
# Run the command
subprocess.run(command, check=True)
if __name__ == "__main__":
try:
run_uvicorn()
except subprocess.CalledProcessError as e:
print(f"Error running uvicorn: {e}", file=sys.stderr)
sys.exit(1)
|