Raghav001 commited on
Commit
91ac044
·
1 Parent(s): b267cca
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -145,6 +145,14 @@ def up_file(files):
145
  return gr.Textbox.update(value='\n'.join(doc_text_list), visible=True), gr.Button.update(
146
  visible=True), gr.Markdown.update(
147
  value="Processing")
 
 
 
 
 
 
 
 
148
 
149
 
150
  with gr.Blocks(css=".gradio-container {background-color: Tomato}, footer {visibility: hidden}") as demo:
@@ -167,7 +175,7 @@ with gr.Blocks(css=".gradio-container {background-color: Tomato}, footer {visibi
167
 
168
  file.change(up_file, [file], [txt, doc_bu, md]) #hiding the text
169
  doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
170
- msg_txt.submit(get_response, [msg_txt, chat_bot,doc_text_state, doc_emb_state], [chat_bot])
171
  chat_bu.click(lambda: None, None, chat_bot, queue=False)
172
 
173
  if __name__ == "__main__":
 
145
  return gr.Textbox.update(value='\n'.join(doc_text_list), visible=True), gr.Button.update(
146
  visible=True), gr.Markdown.update(
147
  value="Processing")
148
+ textbox = gr.inputs.Textbox()
149
+ gr.Interface(fn=my_function, inputs=textbox, outputs=textbox).launch()
150
+
151
+
152
+
153
+ def my_function(text):
154
+ # your function code here
155
+ return gr.Textbox.update(value='')
156
 
157
 
158
  with gr.Blocks(css=".gradio-container {background-color: Tomato}, footer {visibility: hidden}") as demo:
 
175
 
176
  file.change(up_file, [file], [txt, doc_bu, md]) #hiding the text
177
  doc_bu.click(doc_emb, [txt], [doc_text_state, doc_emb_state, msg_txt, chat_bu, md, chat_bot])
178
+ msg_txt.submit(get_response, [msg_txt, chat_bot,doc_text_state, doc_emb_state], [chat_bot]).then(fn=my_function, inputs=msg_txt, outputs=msg_txt)
179
  chat_bu.click(lambda: None, None, chat_bot, queue=False)
180
 
181
  if __name__ == "__main__":