Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,11 +29,13 @@ def generate(prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, r
|
|
29 |
formatted_prompt = format_prompt(prompt, history)
|
30 |
response = client.text_generation(formatted_prompt, **generate_kwargs)
|
31 |
|
32 |
-
if 'choices' in response:
|
|
|
|
|
33 |
return response['choices'][0]['text']
|
34 |
else:
|
35 |
return response['text']
|
36 |
-
|
37 |
def main():
|
38 |
st.title("Mistral 7B Chat Interface")
|
39 |
|
|
|
29 |
formatted_prompt = format_prompt(prompt, history)
|
30 |
response = client.text_generation(formatted_prompt, **generate_kwargs)
|
31 |
|
32 |
+
if isinstance(response, list) and len(response) > 0 and 'choices' in response[0]:
|
33 |
+
return response[0]['choices'][0]['text']
|
34 |
+
elif 'choices' in response:
|
35 |
return response['choices'][0]['text']
|
36 |
else:
|
37 |
return response['text']
|
38 |
+
|
39 |
def main():
|
40 |
st.title("Mistral 7B Chat Interface")
|
41 |
|