EmoCube commited on
Commit
82a1f95
·
verified ·
1 Parent(s): 4c8ca3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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
- print(response.content)
81
- return response.content
 
 
 
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()