OmidSakaki commited on
Commit
e186575
·
verified ·
1 Parent(s): 58e422e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -42,8 +42,14 @@ with gr.Blocks() as app:
42
  raw_output = gr.Textbox(label="متن استخراج شده")
43
  processed_output = gr.Textbox(label="متن پردازش شده")
44
 
 
 
 
 
 
 
45
  process_btn.click(
46
- fn=lambda img: (run_ocr(img), postprocess_text(run_ocr(img))),
47
  inputs=image_input,
48
  outputs=[raw_output, processed_output]
49
  )
 
42
  raw_output = gr.Textbox(label="متن استخراج شده")
43
  processed_output = gr.Textbox(label="متن پردازش شده")
44
 
45
+ def process_image(img):
46
+ # Avoid running OCR twice
47
+ raw = run_ocr(img)
48
+ processed = postprocess_text(raw)
49
+ return raw, processed
50
+
51
  process_btn.click(
52
+ fn=process_image,
53
  inputs=image_input,
54
  outputs=[raw_output, processed_output]
55
  )