nikhmr1235 commited on
Commit
fb9812a
·
verified ·
1 Parent(s): bdb02ff

attempt to fix UI issue

Browse files

fix info: create a row containing the chat interface and initially makes it invisible. When a PDF file is uploaded, the row becomes visible, showing the chat interface.

Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -114,15 +114,15 @@ with gr.Blocks(title="PDF Chatbot") as demo:
114
  interactive=True
115
  )
116
 
117
- chat_interface = gr.ChatInterface(
118
- fn=chatbot.chat_with_pdf,
119
- chatbot=gr.Chatbot(type="messages"),
120
- textbox=gr.Textbox(placeholder="Type your question here...", scale=7),
121
- examples=[["What is the main topic of the document?"], ["Summarize the key findings."], ["Who are the authors?"]],
122
- title="Chat Interface",
123
- theme="soft",
124
- visible=False
125
- )
126
 
127
  def process_and_show_chat(file):
128
  chatbot.process_pdf(file)
@@ -131,7 +131,7 @@ with gr.Blocks(title="PDF Chatbot") as demo:
131
  file_upload_input.upload(
132
  fn=process_and_show_chat,
133
  inputs=[file_upload_input],
134
- outputs=[chat_interface, file_upload_input]
135
  )
136
 
137
  demo.launch()
 
114
  interactive=True
115
  )
116
 
117
+ with gr.Row(visible=False) as chat_row:
118
+ chat_interface = gr.ChatInterface(
119
+ fn=chatbot.chat_with_pdf,
120
+ chatbot=gr.Chatbot(type="messages"),
121
+ textbox=gr.Textbox(placeholder="Type your question here...", scale=7),
122
+ examples=[["What is the main topic of the document?"], ["Summarize the key findings."], ["Who are the authors?"]],
123
+ title="Chat Interface",
124
+ theme="soft"
125
+ )
126
 
127
  def process_and_show_chat(file):
128
  chatbot.process_pdf(file)
 
131
  file_upload_input.upload(
132
  fn=process_and_show_chat,
133
  inputs=[file_upload_input],
134
+ outputs=[chat_row, file_upload_input]
135
  )
136
 
137
  demo.launch()