Spaces:
Sleeping
Sleeping
Improve Ask Questions tab layout with wide textboxes
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
-
|
| 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(
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
ask_btn.click(qa_pipeline, inputs=question, outputs=answer)
|
| 143 |
|
| 144 |
-
demo.launch(
|
| 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()
|