mgbam commited on
Commit
ec074d3
·
verified ·
1 Parent(s): 79808d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -218,14 +218,21 @@ DEMO_LIST = [
218
  # HF Inference Client
219
  HF_TOKEN = os.getenv('HF_TOKEN')
220
 
 
 
 
221
  def get_inference_client(model_id):
222
- """Return an InferenceClient with provider based on model_id."""
223
- provider = "groq" if model_id == "moonshotai/Kimi-K2-Instruct" else "auto"
224
- return InferenceClient(
225
- provider=provider,
226
- api_key=HF_TOKEN,
227
- bill_to="huggingface"
228
- )
 
 
 
 
229
 
230
  # Type definitions
231
  History = List[Tuple[str, str]]
 
218
  # HF Inference Client
219
  HF_TOKEN = os.getenv('HF_TOKEN')
220
 
221
+ HF_TOKEN = os.getenv('HF_TOKEN')
222
+ GROQ_API_KEY = os.getenv('GROQ_API_KEY')
223
+
224
  def get_inference_client(model_id):
225
+ """Return an InferenceClient configured correctly for Hugging Face or Groq."""
226
+ if model_id == "moonshotai/Kimi-K2-Instruct":
227
+ return InferenceClient(
228
+ base_url="https://api.groq.com/openai/v1",
229
+ api_key=GROQ_API_KEY,
230
+ )
231
+ else:
232
+ return InferenceClient(
233
+ model=model_id,
234
+ api_key=HF_TOKEN
235
+ )
236
 
237
  # Type definitions
238
  History = List[Tuple[str, str]]