Spaces:
Paused
Paused
Update tabs/image_ocr_llm.py
Browse files- tabs/image_ocr_llm.py +8 -7
tabs/image_ocr_llm.py
CHANGED
|
@@ -12,18 +12,18 @@ def process_image_with_summary(image):
|
|
| 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 |
-
|
|
|
|
| 18 |
extract_btn = gr.Button("Extract & Summarize")
|
| 19 |
clear_btn = gr.Button("Clear")
|
| 20 |
|
| 21 |
-
with gr.Column():
|
| 22 |
-
#
|
| 23 |
-
gr.Markdown("### 📋 Summary Report", elem_classes="centered-text")
|
| 24 |
-
# Simplified summary content
|
| 25 |
summarized_text = gr.Markdown(label="🧠 Simplified Summary")
|
| 26 |
-
|
| 27 |
with gr.Accordion("📄 View Extracted Text", open=False):
|
| 28 |
extracted_text = gr.Textbox(label="Raw OCR Text", lines=10)
|
| 29 |
|
|
@@ -32,4 +32,5 @@ def image_ocr_llm_tab():
|
|
| 32 |
inputs=img_input,
|
| 33 |
outputs=[extracted_text, summarized_text]
|
| 34 |
)
|
|
|
|
| 35 |
clear_btn.click(lambda: ("", ""), outputs=[extracted_text, summarized_text])
|
|
|
|
| 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 |
+
|
| 16 |
with gr.Row():
|
| 17 |
+
with gr.Column(scale=1): # Left: Upload and buttons
|
| 18 |
+
with gr.Accordion("🖼 Uploaded Image", open=False):
|
| 19 |
+
img_input = gr.Image(type="pil", label="", height=200)
|
| 20 |
extract_btn = gr.Button("Extract & Summarize")
|
| 21 |
clear_btn = gr.Button("Clear")
|
| 22 |
|
| 23 |
+
with gr.Column(scale=2): # Right: Summary and Extracted text
|
| 24 |
+
gr.Markdown("### 🧾 Summary Report", elem_classes="centered-text")
|
|
|
|
|
|
|
| 25 |
summarized_text = gr.Markdown(label="🧠 Simplified Summary")
|
| 26 |
+
|
| 27 |
with gr.Accordion("📄 View Extracted Text", open=False):
|
| 28 |
extracted_text = gr.Textbox(label="Raw OCR Text", lines=10)
|
| 29 |
|
|
|
|
| 32 |
inputs=img_input,
|
| 33 |
outputs=[extracted_text, summarized_text]
|
| 34 |
)
|
| 35 |
+
|
| 36 |
clear_btn.click(lambda: ("", ""), outputs=[extracted_text, summarized_text])
|