Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -76,9 +76,12 @@ def run_huggingface_model(model, messages, max_tokens, temperature, top_p):
|
|
76 |
|
77 |
model = "https://api-inference.huggingface.co/models/" + model + "/v1/chat/completions";
|
78 |
response = requests.post(model, headers=headers, json=payload, timeout=30)
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
82 |
|
83 |
def run_together_model(model, messages, max_tokens, temperature, top_p):
|
84 |
client = Together()
|
|
|
76 |
|
77 |
model = "https://api-inference.huggingface.co/models/" + model + "/v1/chat/completions";
|
78 |
response = requests.post(model, headers=headers, json=payload, timeout=30)
|
79 |
+
|
80 |
+
if (response.error):
|
81 |
+
print("ERROR: " + response.error)
|
82 |
+
else:
|
83 |
+
result = response.choices[0].message.content
|
84 |
+
return result
|
85 |
|
86 |
def run_together_model(model, messages, max_tokens, temperature, top_p):
|
87 |
client = Together()
|