raviix46 commited on
Commit
2592f64
·
verified ·
1 Parent(s): 8eef23e

Update tabs/image_ocr_llm.py

Browse files
Files changed (1) hide show
  1. tabs/image_ocr_llm.py +12 -4
tabs/image_ocr_llm.py CHANGED
@@ -10,8 +10,8 @@ def process_image_with_summary(image):
10
  return text, summary
11
 
12
  def image_ocr_llm_tab():
13
- with gr.Tab("📸 OCR + Summary"):
14
- gr.Markdown("## 🖼️ Upload and Get Summarized Health Report", elem_classes="centered-text")
15
  with gr.Row():
16
  with gr.Column():
17
  img_input = gr.Image(type="pil", label="Upload Image")
@@ -19,8 +19,16 @@ def image_ocr_llm_tab():
19
  clear_btn = gr.Button("Clear")
20
 
21
  with gr.Column():
22
- extracted_text = gr.Textbox(label="📄 Extracted Text", lines=10)
23
  summarized_text = gr.Markdown(label="🧠 Simplified Summary")
 
 
 
 
24
 
25
- extract_btn.click(process_image_with_summary, inputs=img_input, outputs=[extracted_text, summarized_text])
 
 
 
 
26
  clear_btn.click(lambda: ("", ""), outputs=[extracted_text, summarized_text])
 
10
  return text, summary
11
 
12
  def image_ocr_llm_tab():
13
+ with gr.Tab("🧾 OCR + Summary"):
14
+ gr.Markdown("## 📤 Upload and Get Summarized Health Report", elem_classes="centered-text")
15
  with gr.Row():
16
  with gr.Column():
17
  img_input = gr.Image(type="pil", label="Upload Image")
 
19
  clear_btn = gr.Button("Clear")
20
 
21
  with gr.Column():
22
+ # First show summary
23
  summarized_text = gr.Markdown(label="🧠 Simplified Summary")
24
+
25
+ # Then allow optional view of raw OCR
26
+ with gr.Accordion("📄 View Extracted Text", open=False):
27
+ extracted_text = gr.Textbox(label="Raw OCR Text", lines=10)
28
 
29
+ extract_btn.click(
30
+ process_image_with_summary,
31
+ inputs=img_input,
32
+ outputs=[extracted_text, summarized_text]
33
+ )
34
  clear_btn.click(lambda: ("", ""), outputs=[extracted_text, summarized_text])