raviix46 commited on
Commit
e8caf21
·
verified ·
1 Parent(s): 27afb97

Update tabs/image_ocr_llm.py

Browse files
Files changed (1) hide show
  1. 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.llm_ocr import extract_text_llm
3
 
4
  def image_ocr_llm_tab():
5
- gr.Markdown("## 📸 Extract Handwritten Text from Image using LLaMA-Vision", elem_classes="centered-text")
 
 
 
 
 
 
6
 
7
- with gr.Row():
8
- with gr.Column(scale=1):
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
- submit_btn.click(fn=extract_text_llm, inputs=input_image, outputs=extracted_output)
 
 
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)