Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,55 +84,34 @@ def render_first(pdf_file):
|
|
| 84 |
|
| 85 |
# Streamlit & Gradio Interface
|
| 86 |
|
| 87 |
-
st.title("PDF-Powered Chatbot")
|
| 88 |
-
|
| 89 |
-
with st.container():
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
# Assuming you want to process the first PDF initially
|
| 117 |
-
pdf_upload1.upload(fn=render_first, inputs=[pdf_upload1], outputs=[show_img])
|
| 118 |
-
|
| 119 |
-
txt = gr.Textbox(label="Enter your query", placeholder="Ask a question...")
|
| 120 |
-
submit_btn = gr.Button('Submit')
|
| 121 |
-
|
| 122 |
-
# 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(
|
| 131 |
-
[render_first, add_text, generate_response, render_file],
|
| 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 |
|
| 138 |
|
|
|
|
| 84 |
|
| 85 |
# Streamlit & Gradio Interface
|
| 86 |
|
| 87 |
+
st.title("PDF-Powered Chatbot")
|
| 88 |
+
|
| 89 |
+
with st.container():
|
| 90 |
+
gr.Markdown("""
|
| 91 |
+
<style>
|
| 92 |
+
.image-container { height: 680px; }
|
| 93 |
+
</style>
|
| 94 |
+
""")
|
| 95 |
+
|
| 96 |
+
with gr.Blocks() as demo:
|
| 97 |
+
# ... (rest of your interface creation)
|
| 98 |
+
|
| 99 |
+
txt = gr.Textbox(label="Enter your query", placeholder="Ask a question...")
|
| 100 |
+
submit_btn = gr.Button('Submit')
|
| 101 |
+
|
| 102 |
+
@submit_btn.capture()
|
| 103 |
+
def on_submit():
|
| 104 |
+
add_text(chatbot, txt)
|
| 105 |
+
generate_response(chatbot, txt, pdf_upload1)
|
| 106 |
+
render_file(pdf_upload1)
|
| 107 |
+
|
| 108 |
+
if __name__ == "__main__":
|
| 109 |
+
gr.Interface(
|
| 110 |
+
[render_first, add_text, generate_response, render_file],
|
| 111 |
+
[pdf_upload1, chatbot, txt, pdf_upload2, pdf_upload3],
|
| 112 |
+
[show_img, chatbot, txt],
|
| 113 |
+
title="PDF-Powered Chatbot"
|
| 114 |
+
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
|
| 117 |
|