Spaces:
Paused
Paused
Update tabs/image_ocr_llm.py
Browse files- tabs/image_ocr_llm.py +12 -9
tabs/image_ocr_llm.py
CHANGED
|
@@ -1,14 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from components.
|
| 3 |
|
| 4 |
def image_ocr_llm_tab():
|
| 5 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
input_image = gr.Image(type="filepath", label="Upload Handwritten Image")
|
| 10 |
-
submit_btn = gr.Button("Extract Text")
|
| 11 |
-
with gr.Column(scale=2):
|
| 12 |
-
extracted_output = gr.Textbox(label="Extracted Text", lines=20)
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from components.llm_ocr_blip import extract_text_blip
|
| 3 |
|
| 4 |
def image_ocr_llm_tab():
|
| 5 |
+
with gr.Tab("🧾 Image OCR (LLM-based)"):
|
| 6 |
+
gr.Markdown("## 🧾 Upload Image and Extract Text", elem_classes="centered-text")
|
| 7 |
+
with gr.Row():
|
| 8 |
+
with gr.Column():
|
| 9 |
+
img_input = gr.Image(type="pil", label="Upload Image (handwritten or typed)")
|
| 10 |
+
submit_btn = gr.Button("Extract Text", elem_id="process-btn")
|
| 11 |
+
clear_btn = gr.Button("Clear")
|
| 12 |
|
| 13 |
+
with gr.Column():
|
| 14 |
+
output_box = gr.Textbox(label="📄 Extracted Text", lines=12)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
submit_btn.click(extract_text_blip, inputs=img_input, outputs=output_box)
|
| 17 |
+
clear_btn.click(lambda: "", inputs=[], outputs=output_box)
|