Spaces:
Sleeping
Sleeping
alexpantex
commited on
Upload scripts/api.py with huggingface_hub
Browse files- scripts/api.py +3 -1
scripts/api.py
CHANGED
@@ -32,7 +32,9 @@ def root():
|
|
32 |
|
33 |
def start_api_server():
|
34 |
import uvicorn
|
35 |
-
|
|
|
|
|
36 |
|
37 |
@app.post("/search", response_model=QueryResponse)
|
38 |
async def search_prompts(query_request: QueryRequest):
|
|
|
32 |
|
33 |
def start_api_server():
|
34 |
import uvicorn
|
35 |
+
port = int(os.getenv("PORT", 7860)) # HF Spaces uses 7860 by default
|
36 |
+
host = os.getenv("HOST", "0.0.0.0")
|
37 |
+
uvicorn.run(app, host=host, port=port)
|
38 |
|
39 |
@app.post("/search", response_model=QueryResponse)
|
40 |
async def search_prompts(query_request: QueryRequest):
|