Nikhil0987 commited on
Commit
a060be9
·
verified ·
1 Parent(s): c98b120

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -20
app.py CHANGED
@@ -120,23 +120,31 @@ with st.container():
120
  txt = gr.Textbox(label="Enter your query", placeholder="Ask a question...")
121
  submit_btn = gr.Button('Submit')
122
 
123
- submit_btn.click(
124
- fn=add_text, inputs=[chatbot, txt], outputs=[chatbot], queue=False
125
- ).success(
126
- # How do you want to use the different uploads here?
127
- fn=generate_response, inputs=[chatbot, txt, pdf_upload1], outputs=[chatbot, txt]
128
- ).success(
129
- fn=render_file, inputs=[pdf_upload1], outputs=[show_img]
130
- )
131
-
132
- if __name__ == "__main__":
133
- gr.Interface(
134
- [render_first, add_text, generate_response, render_file],
135
- [pdf_upload1, chatbot, txt, pdf_upload2, pdf_upload3],
136
- [show_img, chatbot, txt, show_img],
137
- title="PDF-Powered Chatbot"
138
- ).launch()
139
- print(enable_box)
140
- print(disable_box)
141
- print(change_api_key)
142
- print(chatbot)
 
 
 
 
 
 
 
 
 
120
  txt = gr.Textbox(label="Enter your query", placeholder="Ask a question...")
121
  submit_btn = gr.Button('Submit')
122
 
123
+ # submit_btn.click(
124
+ # fn=add_text, inputs=[chatbot, txt], outputs=[chatbot], queue=False
125
+ # ).success(
126
+ # # How do you want to use the different uploads here?
127
+ # fn=generate_response, inputs=[chatbot, txt, pdf_upload1], outputs=[chatbot, txt]
128
+ # ).success(
129
+ # fn=render_file, inputs=[pdf_upload1], outputs=[show_img]
130
+ # )
131
+
132
+ if __name__ == "__main__":
133
+ gr.Interface(
134
+ [render_first, add_text, generate_response, render_file],
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
+
140
+ # Modified Event Handlers
141
+ submit_btn.click(
142
+ fn=add_text, inputs=[chatbot, txt], outputs=[chatbot], queue=False
143
+ )
144
+ chatbot.change(
145
+ fn=generate_response, inputs=[chatbot, txt, pdf_upload1], outputs=[chatbot, txt]
146
+ )
147
+ txt.change(
148
+ fn=render_file, inputs=[pdf_upload1], outputs=[show_img]
149
+ )
150
+