File size: 489 Bytes
56a64e0 4b81310 8725d0d 56a64e0 |
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)
|