Spaces:
Running
Running
Merge branch 'main' of https://huggingface.co/spaces/moazx/API
Browse files- api/middleware.py +1 -2
- app.py +5 -7
api/middleware.py
CHANGED
|
@@ -147,8 +147,7 @@ def get_cors_middleware_config():
|
|
| 147 |
# Default to allowing Hugging Face Space and localhost
|
| 148 |
# Include null for file:// protocol and common local development origins
|
| 149 |
allowed_origins = [
|
| 150 |
-
"
|
| 151 |
-
"https://huggingface.co",
|
| 152 |
"http://localhost:8000",
|
| 153 |
"http://127.0.0.1:8000",
|
| 154 |
"http://localhost:5500", # Live Server default port
|
|
|
|
| 147 |
# Default to allowing Hugging Face Space and localhost
|
| 148 |
# Include null for file:// protocol and common local development origins
|
| 149 |
allowed_origins = [
|
| 150 |
+
"https://moazx-api.hf.space",
|
|
|
|
| 151 |
"http://localhost:8000",
|
| 152 |
"http://127.0.0.1:8000",
|
| 153 |
"http://localhost:5500", # Live Server default port
|
app.py
CHANGED
|
@@ -9,15 +9,13 @@ import uvicorn
|
|
| 9 |
sys.path.append(os.path.join(os.path.dirname(__file__), 'core'))
|
| 10 |
|
| 11 |
if __name__ == "__main__":
|
| 12 |
-
# Get port from environment variable (Hugging Face uses PORT env var)
|
| 13 |
-
port = int(os.environ.get("PORT", 7860))
|
| 14 |
|
| 15 |
uvicorn.run(
|
| 16 |
"api.app:app",
|
| 17 |
-
host="
|
| 18 |
-
port=
|
| 19 |
-
reload=
|
| 20 |
log_level="info",
|
| 21 |
access_log=True,
|
| 22 |
-
workers=1 # Single worker for
|
| 23 |
-
)
|
|
|
|
| 9 |
sys.path.append(os.path.join(os.path.dirname(__file__), 'core'))
|
| 10 |
|
| 11 |
if __name__ == "__main__":
|
|
|
|
|
|
|
| 12 |
|
| 13 |
uvicorn.run(
|
| 14 |
"api.app:app",
|
| 15 |
+
host="127.0.0.1", # Use localhost instead of 0.0.0.0
|
| 16 |
+
port=8000,
|
| 17 |
+
reload=True, # Disable reload in production for faster startup
|
| 18 |
log_level="info",
|
| 19 |
access_log=True,
|
| 20 |
+
workers=1 # Single worker for development
|
| 21 |
+
)
|