Update app.py
Browse files
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
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
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]]
|