Update app.py
Browse files
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 |
-
|
81 |
except Exception:
|
82 |
app.chat_history.append((query, "I have no information about it. Feed me knowledge, please!"))
|
83 |
-
|
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(
|
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,
|
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(
|