Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,17 +22,18 @@ def models(text, model="Mixtral 8x7B"):
|
|
22 |
|
23 |
generate_kwargs = dict(
|
24 |
max_new_tokens=300,
|
|
|
25 |
)
|
26 |
|
27 |
formatted_prompt = system_instructions1 + text + "[ANSWER]"
|
28 |
-
stream = client.text_generation(
|
29 |
-
formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
30 |
output = ""
|
31 |
for response in stream:
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
return output
|
37 |
|
38 |
description="""# Chat GO
|
|
|
22 |
|
23 |
generate_kwargs = dict(
|
24 |
max_new_tokens=300,
|
25 |
+
do_sample=True,
|
26 |
)
|
27 |
|
28 |
formatted_prompt = system_instructions1 + text + "[ANSWER]"
|
29 |
+
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
|
|
30 |
output = ""
|
31 |
for response in stream:
|
32 |
+
output+=response.token.text
|
33 |
+
if output.endswith("<|assistant|>"):
|
34 |
+
output = output[:-13]
|
35 |
+
elif output.endswith("</s>"):
|
36 |
+
output = output[:-4]
|
37 |
return output
|
38 |
|
39 |
description="""# Chat GO
|