Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,7 +83,6 @@ def render_first(pdf_file):
|
|
| 83 |
return image
|
| 84 |
|
| 85 |
# Streamlit & Gradio Interface
|
| 86 |
-
|
| 87 |
|
| 88 |
st.title("PDF-Powered Chatbot")
|
| 89 |
|
|
@@ -120,14 +119,12 @@ with st.container():
|
|
| 120 |
txt = gr.Textbox(label="Enter your query", placeholder="Ask a question...")
|
| 121 |
submit_btn = gr.Button('Submit')
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
)
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
fn=render_file, inputs=[pdf_upload1], outputs=[show_img]
|
| 130 |
-
)
|
| 131 |
|
| 132 |
if __name__ == "__main__":
|
| 133 |
gr.Interface(
|
|
@@ -135,5 +132,6 @@ if __name__ == "__main__":
|
|
| 135 |
[pdf_upload1, chatbot, txt, pdf_upload2, pdf_upload3],
|
| 136 |
[show_img, chatbot, txt], # Assuming you want to display initially
|
| 137 |
title="PDF-Powered Chatbot"
|
| 138 |
-
).launch()
|
|
|
|
| 139 |
|
|
|
|
| 83 |
return image
|
| 84 |
|
| 85 |
# Streamlit & Gradio Interface
|
|
|
|
| 86 |
|
| 87 |
st.title("PDF-Powered Chatbot")
|
| 88 |
|
|
|
|
| 119 |
txt = gr.Textbox(label="Enter your query", placeholder="Ask a question...")
|
| 120 |
submit_btn = gr.Button('Submit')
|
| 121 |
|
| 122 |
+
# Modified event handler for submit button
|
| 123 |
+
@submit_btn.capture()
|
| 124 |
+
def on_submit():
|
| 125 |
+
add_text(chatbot, txt)
|
| 126 |
+
generate_response(chatbot, txt, pdf_upload1)
|
| 127 |
+
render_file(pdf_upload1)
|
|
|
|
|
|
|
| 128 |
|
| 129 |
if __name__ == "__main__":
|
| 130 |
gr.Interface(
|
|
|
|
| 132 |
[pdf_upload1, chatbot, txt, pdf_upload2, pdf_upload3],
|
| 133 |
[show_img, chatbot, txt], # Assuming you want to display initially
|
| 134 |
title="PDF-Powered Chatbot"
|
| 135 |
+
).launch()
|
| 136 |
+
|
| 137 |
|