alexpantex commited on
Commit
b9972a2
·
verified ·
1 Parent(s): 65086a3

Upload scripts/api.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. 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
- uvicorn.run(app, host = config["server"]["host"], port = int(os.getenv("PORT", config["server"]["port"])))
 
 
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):