Samarth991 commited on
Commit
31c19b2
1 Parent(s): a5b8a59

Adding chat clear button

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -138,10 +138,11 @@ css="""
138
  title = """
139
  <div style="text-align: center;max-width: 700px;">
140
  <h1>Chat with Data • OpenAI/HuggingFace</h1>
141
- <p style="text-align: center;">Upload a file from your computer, click the "Load data to LangChain" button, <br />
142
  when everything is ready, you can start asking questions about the data you uploaded ;) <br />
143
- This version is just for QA retrival so it will not use chat history, and uses Hugging face as LLM,
144
- so you don't need any key</p>
 
145
  </div>
146
  """
147
 
@@ -156,7 +157,7 @@ with gr.Blocks(css=css) as demo:
156
  with gr.Row():
157
  question = gr.Textbox(label="Type your question?",lines=1).style(full_width=False)
158
  submit_btn = gr.Button(value="Send message", variant="primary", scale = 1)
159
- clean_chat = gr.Button(Value = "Clear chat", variant="primary", scale = 1)
160
 
161
  with gr.Column():
162
  with gr.Box():
@@ -196,7 +197,7 @@ with gr.Blocks(css=css) as demo:
196
 
197
  question.submit(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
198
  submit_btn.click(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
199
- clean_chat.click(clear_chat, [], chatbot)
200
 
201
 
202
  demo.launch()
 
138
  title = """
139
  <div style="text-align: center;max-width: 700px;">
140
  <h1>Chat with Data • OpenAI/HuggingFace</h1>
141
+ <p style="text-align: center;">Upload a file from your system, click the "UpLoad file and generate embeddings" button, <br />
142
  when everything is ready, you can start asking questions about the data you uploaded ;) <br />
143
+ This version is just for QA retrival so it will not use chat history, and gives you option to use HuggingFace/OpenAI as LLM's,
144
+ make sure to add your key .
145
+ </p>
146
  </div>
147
  """
148
 
 
157
  with gr.Row():
158
  question = gr.Textbox(label="Type your question?",lines=1).style(full_width=False)
159
  submit_btn = gr.Button(value="Send message", variant="primary", scale = 1)
160
+ clean_chat_btn = gr.Button("✨ Delete all history")
161
 
162
  with gr.Column():
163
  with gr.Box():
 
197
 
198
  question.submit(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
199
  submit_btn.click(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
200
+ clean_chat_btn.click(clear_chat, [], chatbot)
201
 
202
 
203
  demo.launch()