Spaces:
Runtime error
Runtime error
Commit ·
2a73022
1
Parent(s): 9a5d1e4
changed to uvicorn setup for HF v16
Browse files- main/api.py +7 -4
- main/config.yaml +2 -1
main/api.py
CHANGED
|
@@ -29,11 +29,14 @@ class InferenceApi(LitAPI):
|
|
| 29 |
|
| 30 |
async def _get_client(self):
|
| 31 |
"""Get or create HTTP client as needed"""
|
| 32 |
-
|
|
|
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
if 'hf.space' in
|
| 36 |
-
base_url =
|
|
|
|
|
|
|
| 37 |
|
| 38 |
return httpx.AsyncClient(
|
| 39 |
base_url=base_url,
|
|
|
|
| 29 |
|
| 30 |
async def _get_client(self):
|
| 31 |
"""Get or create HTTP client as needed"""
|
| 32 |
+
host = self.llm_config.get('host', 'localhost')
|
| 33 |
+
port = self.llm_config.get('port', 8002)
|
| 34 |
|
| 35 |
+
# Construct base URL, omitting port for HF spaces
|
| 36 |
+
if 'hf.space' in host:
|
| 37 |
+
base_url = f"https://{host}"
|
| 38 |
+
else:
|
| 39 |
+
base_url = f"http://{host}:{port}"
|
| 40 |
|
| 41 |
return httpx.AsyncClient(
|
| 42 |
base_url=base_url,
|
main/config.yaml
CHANGED
|
@@ -5,7 +5,8 @@ server:
|
|
| 5 |
max_batch_size: 1
|
| 6 |
|
| 7 |
llm_server:
|
| 8 |
-
|
|
|
|
| 9 |
timeout: 60.0
|
| 10 |
api_prefix: "/api/v1" # This will be used for route prefixing
|
| 11 |
endpoints:
|
|
|
|
| 5 |
max_batch_size: 1
|
| 6 |
|
| 7 |
llm_server:
|
| 8 |
+
host: "teamgenki-llmserver.hf.space"
|
| 9 |
+
port: 7860 # Will be ignored for hf.space URLs
|
| 10 |
timeout: 60.0
|
| 11 |
api_prefix: "/api/v1" # This will be used for route prefixing
|
| 12 |
endpoints:
|