Spaces:
Runtime error
Runtime error
Commit
·
9a5d1e4
1
Parent(s):
94c7e5b
changed to uvicorn setup for HF v15
Browse files- main/api.py +7 -1
main/api.py
CHANGED
@@ -29,8 +29,14 @@ class InferenceApi(LitAPI):
|
|
29 |
|
30 |
async def _get_client(self):
|
31 |
"""Get or create HTTP client as needed"""
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
return httpx.AsyncClient(
|
33 |
-
base_url=
|
34 |
timeout=float(self.llm_config.get('timeout', 60.0))
|
35 |
)
|
36 |
|
|
|
29 |
|
30 |
async def _get_client(self):
|
31 |
"""Get or create HTTP client as needed"""
|
32 |
+
base_url = self.llm_config.get('base_url', 'http://localhost:8002')
|
33 |
+
|
34 |
+
# If it's a HF space URL, remove any port specification
|
35 |
+
if 'hf.space' in base_url:
|
36 |
+
base_url = base_url.split(':')[0] # Take everything before any port number
|
37 |
+
|
38 |
return httpx.AsyncClient(
|
39 |
+
base_url=base_url,
|
40 |
timeout=float(self.llm_config.get('timeout', 60.0))
|
41 |
)
|
42 |
|