AurelioAguirre commited on
Commit
2a73022
·
1 Parent(s): 9a5d1e4

changed to uvicorn setup for HF v16

Browse files
Files changed (2) hide show
  1. main/api.py +7 -4
  2. 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
- 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,
 
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
- base_url: "https://teamgenki-llmserver.hf.space:7860" # The base URL of the LLM server
 
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: