Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -97,6 +97,9 @@ def conversation(qa_chain, message, history):
|
|
97 |
*source_texts[:5], # Unpack exactly 5 source texts
|
98 |
*source_pages[:5]) # Unpack exactly 5 source pages
|
99 |
|
|
|
|
|
|
|
100 |
def demo():
|
101 |
with gr.Blocks(theme="base") as demo:
|
102 |
vector_db = gr.State()
|
@@ -140,7 +143,12 @@ def demo():
|
|
140 |
|
141 |
submit_btn.click(conversation, inputs=[qa_chain, msg, chatbot], outputs=[qa_chain, msg, chatbot] + doc_sources + source_pages)
|
142 |
msg.submit(conversation, inputs=[qa_chain, msg, chatbot], outputs=[qa_chain, msg, chatbot] + doc_sources + source_pages)
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
144 |
demo.queue().launch(debug=True)
|
145 |
|
146 |
if __name__ == "__main__":
|
|
|
97 |
*source_texts[:5], # Unpack exactly 5 source texts
|
98 |
*source_pages[:5]) # Unpack exactly 5 source pages
|
99 |
|
100 |
+
def clear_conversation():
|
101 |
+
return gr.update(value=""), [], "", "", "", "", "", 0, 0, 0, 0, 0
|
102 |
+
|
103 |
def demo():
|
104 |
with gr.Blocks(theme="base") as demo:
|
105 |
vector_db = gr.State()
|
|
|
143 |
|
144 |
submit_btn.click(conversation, inputs=[qa_chain, msg, chatbot], outputs=[qa_chain, msg, chatbot] + doc_sources + source_pages)
|
145 |
msg.submit(conversation, inputs=[qa_chain, msg, chatbot], outputs=[qa_chain, msg, chatbot] + doc_sources + source_pages)
|
146 |
+
clear_btn.click(
|
147 |
+
clear_conversation,
|
148 |
+
inputs=[],
|
149 |
+
outputs=[chatbot] + doc_sources + source_pages
|
150 |
+
)
|
151 |
+
|
152 |
demo.queue().launch(debug=True)
|
153 |
|
154 |
if __name__ == "__main__":
|