cicboy commited on
Commit
6ee1bbb
Β·
1 Parent(s): 918044e

Improve Ask Questions tab layout with wide textboxes

Browse files
Files changed (1) hide show
  1. app.py +23 -11
app.py CHANGED
@@ -126,20 +126,32 @@ def process_pdf(pdf_file):
126
  def qa_pipeline(question):
127
  return ask_question(question)
128
 
129
- with gr.Blocks() as demo:
130
- gr.Markdown("## πŸ“„ PDF Q&A Bot with Weaviate + OpenAI")
 
 
 
 
 
 
 
 
 
 
131
 
132
- with gr.Tab("Upload PDF"):
133
- pdf_input = gr.File(label="Upload PDF", type="filepath")
134
- upload_btn = gr.Button("Process PDF")
135
- status = gr.Textbox(label="Status")
136
- upload_btn.click(process_pdf, inputs=pdf_input, outputs=status)
137
 
138
  with gr.Tab("Ask Questions"):
139
- question = gr.Textbox(label="Your Question")
140
- answer = gr.Textbox(label="Answer")
141
- ask_btn = gr.Button("Ask")
 
 
 
 
 
 
142
  ask_btn.click(qa_pipeline, inputs=question, outputs=answer)
143
 
144
- demo.launch(share=True)
145
  client.close()
 
126
  def qa_pipeline(question):
127
  return ask_question(question)
128
 
129
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
130
+ # Global CSS injected explicitly
131
+ gr.HTML("""
132
+ <style>
133
+ /* widen overall container */
134
+ .gradio-container { max-width: 1100px !important; margin: auto; }
135
+
136
+ /* make textareas bigger & full width */
137
+ #qbox textarea { width: 100% !important; min-height: 110px !important; font-size: 16px !important; }
138
+ #abox textarea { width: 100% !important; min-height: 220px !important; font-size: 16px !important; }
139
+ </style>
140
+ """)
141
 
142
+ gr.Markdown("## πŸ“„ PDF Q&A Bot with Weaviate + OpenAI")
 
 
 
 
143
 
144
  with gr.Tab("Ask Questions"):
145
+ question = gr.Textbox(
146
+ label="Your Question",
147
+ elem_id="qbox" # πŸ‘ˆ ID we target in CSS
148
+ )
149
+ answer = gr.Textbox(
150
+ label="Answer",
151
+ elem_id="abox" # πŸ‘ˆ ID we target in CSS
152
+ )
153
+ ask_btn = gr.Button("Ask", size="lg")
154
  ask_btn.click(qa_pipeline, inputs=question, outputs=answer)
155
 
156
+ demo.launch()
157
  client.close()