Shriharsh commited on
Commit
e811f80
·
verified ·
1 Parent(s): 834264c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -12
app.py CHANGED
@@ -241,22 +241,38 @@ def diabetes_bot(query, pdf_file=None):
241
 
242
  # Gradio interface
243
  with gr.Blocks() as app:
244
- gr.Markdown("""
 
245
  # Diabetes Research ChatBot Powered By Gemini 1.5 Flash And Pinecone 🩺
246
  **Powered by the latest diabetes research, Running on Gemini 1.5 Flash API**
247
- Ask questions about diabetes directly or upload a research paper (up to 10 pages) for specific Q&A.
248
- **Disclaimer:**
249
- The information provided by this chatbot is for research and informational purposes only and is not intended to substitute professional medical advice, diagnosis,
250
- or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.
251
-
252
- """)
253
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  with gr.Row():
255
- query_input = gr.Textbox(label="Ask a question", placeholder="e.g., What are the latest treatments for type 2 diabetes?")
256
- pdf_input = gr.File(label="Upload a PDF (optional, max 10 pages)", file_types=[".pdf"])
257
-
258
- submit_button = gr.Button("Submit")
259
- output = gr.Textbox(label="Answer")
 
 
 
 
 
 
 
 
260
 
261
  submit_button.click(
262
  fn=diabetes_bot,
@@ -264,5 +280,11 @@ with gr.Blocks() as app:
264
  outputs=output
265
  )
266
 
 
 
 
 
 
 
267
  # Launch the app
268
  app.launch()
 
241
 
242
  # Gradio interface
243
  with gr.Blocks() as app:
244
+ gr.Markdown(
245
+ """
246
  # Diabetes Research ChatBot Powered By Gemini 1.5 Flash And Pinecone 🩺
247
  **Powered by the latest diabetes research, Running on Gemini 1.5 Flash API**
248
+ Ask questions about diabetes directly or upload a research paper (up to 10 pages) for specific Q&A.
 
 
 
 
 
249
 
250
+ <br>
251
+ <div style="border: 1px solid #ccc; border-radius: 5px; padding: 10px; background-color: #f9f9f9;">
252
+ **Disclaimer:**
253
+ The information provided by this chatbot is for research and informational purposes only and is not intended to substitute professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.
254
+ </div>
255
+ <br>
256
+ *Example Queries:*
257
+ - "What is new with type 2 diabetes management research?"
258
+ - "Tell me about new treatments in diabetes if any."
259
+ """,
260
+ unsafe_allow_html=True)
261
+
262
  with gr.Row():
263
+ query_input = gr.Textbox(label="Ask a Question", placeholder="Type your diabetes-related query here...", lines=2)
264
+ with gr.Column(scale=0.5):
265
+ pdf_input = gr.File(label="Upload a PDF (optional, max 10 pages)", file_types=[".pdf"])
266
+
267
+ with gr.Row():
268
+ submit_button = gr.Button("Submit", variant="primary")
269
+ clear_button = gr.Button("Clear")
270
+
271
+ output = gr.Textbox(label="Answer", lines=15)
272
+
273
+ # Function to clear inputs and output
274
+ def clear_all():
275
+ return "", None, ""
276
 
277
  submit_button.click(
278
  fn=diabetes_bot,
 
280
  outputs=output
281
  )
282
 
283
+ clear_button.click(
284
+ fn=clear_all,
285
+ inputs=[],
286
+ outputs=[query_input, pdf_input, output]
287
+ )
288
+
289
  # Launch the app
290
  app.launch()