Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,11 @@ def chatbot(input_text, history, model_choice, system_message, max_new_tokens, t
|
|
38 |
try:
|
39 |
response = model_component(payload) # The response is likely a dictionary
|
40 |
if isinstance(response, dict) and "choices" in response:
|
|
|
41 |
assistant_response = response["choices"][0]["message"]["content"]
|
|
|
|
|
|
|
42 |
else:
|
43 |
assistant_response = "Unexpected model response format."
|
44 |
except Exception as e:
|
|
|
38 |
try:
|
39 |
response = model_component(payload) # The response is likely a dictionary
|
40 |
if isinstance(response, dict) and "choices" in response:
|
41 |
+
# Assuming the response structure is similar to OpenAI's API
|
42 |
assistant_response = response["choices"][0]["message"]["content"]
|
43 |
+
elif isinstance(response, dict) and "generated_text" in response:
|
44 |
+
# If the response is in a different format, adjust accordingly
|
45 |
+
assistant_response = response["generated_text"]
|
46 |
else:
|
47 |
assistant_response = "Unexpected model response format."
|
48 |
except Exception as e:
|