NaimaAqeel commited on
Commit
cf26f9f
·
verified ·
1 Parent(s): 58a740b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -147,23 +147,24 @@ def process_and_query(state, question):
147
  def main():
148
  upload_interface = gr.Interface(
149
  fn=upload_files,
150
- inputs=gr.File(label="Upload PDF or DOCX files", file_count="multiple"), # Specify multiple files
151
- outputs=gr.Textbox(label="Upload Status")
152
  )
153
 
154
  query_interface = gr.Interface(
155
  fn=process_and_query,
156
- inputs=[gr.State(), gr.Textbox(label="Enter your query")],
157
- outputs=[gr.Textbox(label="Query Response"), gr.State()]
158
  )
159
 
160
- with gr.Blocks() as demo:
161
- with gr.Tab("Upload Files"):
162
- upload_interface.render()
163
- with gr.Tab("Query"):
164
- query_interface.render()
165
-
166
- demo.launch()
 
167
 
168
  if __name__ == "__main__":
169
  main()
 
147
  def main():
148
  upload_interface = gr.Interface(
149
  fn=upload_files,
150
+ inputs=gr.inputs.File(label="Upload PDF or DOCX files", multiple=True),
151
+ outputs=gr.outputs.Textbox(label="Upload Status")
152
  )
153
 
154
  query_interface = gr.Interface(
155
  fn=process_and_query,
156
+ inputs=[gr.inputs.Textbox(label="Conversation State"), gr.inputs.Textbox(label="Enter your query")],
157
+ outputs=[gr.outputs.Textbox(label="Query Response"), gr.outputs.Textbox(label="Conversation State")]
158
  )
159
 
160
+ gr.Interface(
161
+ fn=None,
162
+ inputs=[
163
+ gr.Interface.Tab("Upload Files", upload_interface),
164
+ gr.Interface.Tab("Query", query_interface)
165
+ ],
166
+ outputs=gr.outputs.Textbox(label="Output", default="Output will be shown here")
167
+ ).launch()
168
 
169
  if __name__ == "__main__":
170
  main()