Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
import uvicorn
|
|
|
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
@@ -19,6 +20,7 @@ def home():
|
|
| 19 |
def test():
|
| 20 |
return {"result": 123}
|
| 21 |
|
| 22 |
-
# This is
|
| 23 |
if __name__ == "__main__":
|
| 24 |
-
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
import uvicorn
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
app = FastAPI()
|
| 7 |
|
|
|
|
| 20 |
def test():
|
| 21 |
return {"result": 123}
|
| 22 |
|
| 23 |
+
# This is critical for Hugging Face Spaces
|
| 24 |
if __name__ == "__main__":
|
| 25 |
+
port = int(os.getenv("PORT", 7860))
|
| 26 |
+
uvicorn.run(app, host="0.0.0.0", port=port)
|