Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -64,9 +64,11 @@ def stream_chat(
|
|
64 |
print(f'history: {history}')
|
65 |
|
66 |
conversation = []
|
67 |
-
for prompt, answer in history:
|
68 |
-
|
69 |
-
|
|
|
|
|
70 |
conversation.append(UserMessage(content=message))
|
71 |
|
72 |
completion_request = ChatCompletionRequest(messages=conversation)
|
@@ -86,17 +88,13 @@ def stream_chat(
|
|
86 |
time.sleep(0.05)
|
87 |
yield result[: i + 1]
|
88 |
|
89 |
-
chatbot = gr.Chatbot(
|
90 |
-
height=600,
|
91 |
-
placeholder=PLACEHOLDER
|
92 |
-
)
|
93 |
-
|
94 |
with gr.Blocks(theme="ocean", css=CSS) as demo:
|
95 |
gr.HTML(TITLE)
|
96 |
gr.DuplicateButton(value="Duplicate Space for private use", elem_classes="duplicate-button")
|
97 |
gr.ChatInterface(
|
98 |
fn=stream_chat,
|
99 |
-
|
|
|
100 |
examples=[
|
101 |
["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],
|
102 |
["What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."],
|
|
|
64 |
print(f'history: {history}')
|
65 |
|
66 |
conversation = []
|
67 |
+
# for prompt, answer in history:
|
68 |
+
# conversation.append(UserMessage(content=prompt))
|
69 |
+
# conversation.append(AssistantMessage(content=answer))
|
70 |
+
if history:
|
71 |
+
conversation.extend(history)
|
72 |
conversation.append(UserMessage(content=message))
|
73 |
|
74 |
completion_request = ChatCompletionRequest(messages=conversation)
|
|
|
88 |
time.sleep(0.05)
|
89 |
yield result[: i + 1]
|
90 |
|
|
|
|
|
|
|
|
|
|
|
91 |
with gr.Blocks(theme="ocean", css=CSS) as demo:
|
92 |
gr.HTML(TITLE)
|
93 |
gr.DuplicateButton(value="Duplicate Space for private use", elem_classes="duplicate-button")
|
94 |
gr.ChatInterface(
|
95 |
fn=stream_chat,
|
96 |
+
type="messages",
|
97 |
+
fill_height=True,
|
98 |
examples=[
|
99 |
["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],
|
100 |
["What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."],
|