Rahatara commited on
Commit
6d2d6ff
1 Parent(s): e0ac1ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -77,10 +77,10 @@ def get_response(history, query, file):
77
  source_texts_str = "\n\n".join(source_texts)
78
  for char in result["answer"]:
79
  history[-1][-1] += char
80
- yield history, "", source_texts_str
81
  except Exception:
82
  app.chat_history.append((query, "I have no information about it. Feed me knowledge, please!"))
83
- yield history, "", "I have no information about it. Feed me knowledge, please!"
84
 
85
  def render_file(file) -> Image.Image:
86
  doc = fitz.open(file.name)
@@ -118,7 +118,7 @@ with gr.Blocks() as demo:
118
  status_text = gr.Textbox(label="Status", value="", interactive=False)
119
 
120
  with gr.Tab("Step 4: Ask Questions"):
121
- chatbot = gr.Chatbot(value=[], elem_id="chatbot")
122
  txt = gr.Textbox(
123
  show_label=False,
124
  placeholder="Enter text and press submit",
@@ -152,7 +152,7 @@ with gr.Blocks() as demo:
152
  outputs=[chatbot],
153
  queue=False,
154
  ).success(
155
- fn=get_response, inputs=[chatbot, txt, btn], outputs=[chatbot, txt, source_texts_output]
156
  )
157
 
158
  refresh_btn.click(
 
77
  source_texts_str = "\n\n".join(source_texts)
78
  for char in result["answer"]:
79
  history[-1][-1] += char
80
+ return history, source_texts_str
81
  except Exception:
82
  app.chat_history.append((query, "I have no information about it. Feed me knowledge, please!"))
83
+ return history, "I have no information about it. Feed me knowledge, please!"
84
 
85
  def render_file(file) -> Image.Image:
86
  doc = fitz.open(file.name)
 
118
  status_text = gr.Textbox(label="Status", value="", interactive=False)
119
 
120
  with gr.Tab("Step 4: Ask Questions"):
121
+ chatbot = gr.Chatbot(elem_id="chatbot")
122
  txt = gr.Textbox(
123
  show_label=False,
124
  placeholder="Enter text and press submit",
 
152
  outputs=[chatbot],
153
  queue=False,
154
  ).success(
155
+ fn=get_response, inputs=[chatbot, txt, btn], outputs=[chatbot, source_texts_output]
156
  )
157
 
158
  refresh_btn.click(