Spaces:
Running
Running
Pclanglais
commited on
Commit
•
54eb092
1
Parent(s):
22afce3
Update app.py
Browse files
app.py
CHANGED
@@ -172,11 +172,25 @@ examples = [
|
|
172 |
]
|
173 |
]
|
174 |
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
with gr.Blocks() as demo:
|
178 |
gr.ChatInterface(predict)
|
179 |
gr.HTML("""<h3 style="text-align:center">Sources</h3><p>""" + source_text + """</p>""")
|
180 |
|
181 |
if __name__ == "__main__":
|
182 |
-
demo.queue().launch()
|
|
|
172 |
]
|
173 |
]
|
174 |
|
175 |
+
with gr.Blocks() as demo:
|
176 |
+
chatbot = gr.Chatbot()
|
177 |
+
msg = gr.Textbox()
|
178 |
+
clear = gr.Button("Clear")
|
179 |
+
|
180 |
+
def user(user_message, history):
|
181 |
+
return "", history + [[user_message, None]]
|
182 |
+
|
183 |
+
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
184 |
+
predict, chatbot, chatbot
|
185 |
+
)
|
186 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
187 |
+
|
188 |
+
|
189 |
+
"""demo = gr.Blocks()
|
190 |
|
191 |
with gr.Blocks() as demo:
|
192 |
gr.ChatInterface(predict)
|
193 |
gr.HTML("""<h3 style="text-align:center">Sources</h3><p>""" + source_text + """</p>""")
|
194 |
|
195 |
if __name__ == "__main__":
|
196 |
+
demo.queue().launch()"""
|