Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -62,15 +62,15 @@ def stream_chat(
|
|
62 |
print(f'history: {history}')
|
63 |
|
64 |
conversation = []
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
|
69 |
-
for item in history:
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
conversation.append(UserMessage(content=message))
|
76 |
|
@@ -101,7 +101,7 @@ with gr.Blocks(theme="citrus", css=CSS) as demo:
|
|
101 |
fn=stream_chat,
|
102 |
title="Mistral-lab",
|
103 |
chatbot=chatbot,
|
104 |
-
type="messages",
|
105 |
fill_height=True,
|
106 |
examples=[
|
107 |
["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],
|
@@ -109,6 +109,7 @@ with gr.Blocks(theme="citrus", css=CSS) as demo:
|
|
109 |
["Tell me a random fun fact about the Roman Empire."],
|
110 |
["Show me a code snippet of a website's sticky header in CSS and JavaScript."],
|
111 |
],
|
|
|
112 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
|
113 |
additional_inputs=[
|
114 |
gr.Slider(
|
|
|
62 |
print(f'history: {history}')
|
63 |
|
64 |
conversation = []
|
65 |
+
for prompt, answer in history:
|
66 |
+
conversation.append(UserMessage(content=prompt))
|
67 |
+
conversation.append(AssistantMessage(content=answer))
|
68 |
|
69 |
+
# for item in history:
|
70 |
+
# if item[role] == "user":
|
71 |
+
# conversation.append(UserMessage(content=item[content]))
|
72 |
+
# elif item[role] == "assistant":
|
73 |
+
# conversation.append(AssistantMessage(content=item[content]))
|
74 |
|
75 |
conversation.append(UserMessage(content=message))
|
76 |
|
|
|
101 |
fn=stream_chat,
|
102 |
title="Mistral-lab",
|
103 |
chatbot=chatbot,
|
104 |
+
# type="messages",
|
105 |
fill_height=True,
|
106 |
examples=[
|
107 |
["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],
|
|
|
109 |
["Tell me a random fun fact about the Roman Empire."],
|
110 |
["Show me a code snippet of a website's sticky header in CSS and JavaScript."],
|
111 |
],
|
112 |
+
cache_examples = False,
|
113 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
|
114 |
additional_inputs=[
|
115 |
gr.Slider(
|