Spaces:
Building
Building
Commit
·
ac94949
1
Parent(s):
a1a0b64
Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,11 @@ with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
|
46 |
with gr.Tab('Just Text'):
|
47 |
chatbot = gr.Chatbot(height=600)
|
48 |
msg = gr.Textbox()
|
49 |
-
|
|
|
|
|
|
|
|
|
50 |
|
51 |
def user(user_message, history):
|
52 |
store = store + [[user_message, None]]
|
@@ -60,16 +64,17 @@ with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
|
60 |
store[-1][1] = history[-1][1]
|
61 |
time.sleep(0.01)
|
62 |
yield history
|
63 |
-
|
|
|
|
|
64 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
65 |
bot, chatbot, chatbot
|
66 |
)
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
gr.Markdown(f"Query: {generation[0]}\nAnswer: {generation[1]}")
|
73 |
|
74 |
with gr.Tab('Just Chat'):
|
75 |
chatbot = gr.Chatbot(height=600)
|
|
|
46 |
with gr.Tab('Just Text'):
|
47 |
chatbot = gr.Chatbot(height=600)
|
48 |
msg = gr.Textbox()
|
49 |
+
clear = gr.Button("Clear")
|
50 |
+
accordion = gr.Accordion("Generation History")
|
51 |
+
|
52 |
+
def record(history):
|
53 |
+
return history
|
54 |
|
55 |
def user(user_message, history):
|
56 |
store = store + [[user_message, None]]
|
|
|
64 |
store[-1][1] = history[-1][1]
|
65 |
time.sleep(0.01)
|
66 |
yield history
|
67 |
+
|
68 |
+
msg.submit(record, accordion, accordion)
|
69 |
+
|
70 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
71 |
bot, chatbot, chatbot
|
72 |
)
|
73 |
|
74 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
75 |
|
76 |
+
# for generation in store:
|
77 |
+
# gr.Markdown(f"Query: {generation[0]}\nAnswer: {generation[1]}")
|
|
|
78 |
|
79 |
with gr.Tab('Just Chat'):
|
80 |
chatbot = gr.Chatbot(height=600)
|