Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,12 @@ import gradio as gr
|
|
4 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
5 |
|
6 |
def format_prompt(message, history):
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
def generate(
|
15 |
prompt, history, temperature=0.2, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
@@ -35,18 +35,19 @@ def generate(
|
|
35 |
|
36 |
for response in stream:
|
37 |
output += response.token.text
|
|
|
38 |
yield output
|
39 |
return output
|
40 |
|
41 |
-
|
42 |
mychatbot = gr.Chatbot(
|
43 |
avatar_images=["./user.png", "./Ember Logo.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,)
|
44 |
|
45 |
-
demo = gr.ChatInterface(fn=generate,
|
46 |
chatbot=mychatbot,
|
47 |
title="Ember_Chat_25",
|
48 |
retry_btn=None,
|
49 |
undo_btn=None
|
50 |
)
|
51 |
|
52 |
-
demo.queue().launch(show_api=False)
|
|
|
4 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
5 |
|
6 |
def format_prompt(message, history):
|
7 |
+
prompt = "<s>"
|
8 |
+
for user_prompt, bot_response in history:
|
9 |
+
prompt += f"[INST] {user_prompt} [/INST]"
|
10 |
+
prompt += f" {bot_response}</s> "
|
11 |
+
prompt += f"[INST] {message} [/INST]"
|
12 |
+
return prompt
|
13 |
|
14 |
def generate(
|
15 |
prompt, history, temperature=0.2, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
|
|
35 |
|
36 |
for response in stream:
|
37 |
output += response.token.text
|
38 |
+
print(output) # Print the response to the console
|
39 |
yield output
|
40 |
return output
|
41 |
|
42 |
+
|
43 |
mychatbot = gr.Chatbot(
|
44 |
avatar_images=["./user.png", "./Ember Logo.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,)
|
45 |
|
46 |
+
demo = gr.ChatInterface(fn=generate,
|
47 |
chatbot=mychatbot,
|
48 |
title="Ember_Chat_25",
|
49 |
retry_btn=None,
|
50 |
undo_btn=None
|
51 |
)
|
52 |
|
53 |
+
demo.queue().launch(show_api=False)
|