Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,14 +97,14 @@ def process(input_type, gr_img, lang):
|
|
| 97 |
return extracted_text
|
| 98 |
|
| 99 |
|
| 100 |
-
def generate_ocr(
|
| 101 |
|
| 102 |
text_output = ''
|
| 103 |
|
| 104 |
add_csv = []
|
| 105 |
image_id = 1
|
| 106 |
-
|
| 107 |
-
|
| 108 |
|
| 109 |
if not text_output:
|
| 110 |
return text_output
|
|
@@ -132,12 +132,11 @@ Create user interface for OCR demo
|
|
| 132 |
# image = gr.Image(shape=(300, 300))
|
| 133 |
# image = gr.File(label="Upload PDF/Image")
|
| 134 |
image = gr.Image()
|
| 135 |
-
method = "Version3"
|
| 136 |
output = gr.Textbox(label="Output")
|
| 137 |
|
| 138 |
demo = gr.Interface(
|
| 139 |
generate_ocr,
|
| 140 |
-
[
|
| 141 |
output,
|
| 142 |
title="Persian Optical Character Recognition",
|
| 143 |
css=".gradio-container {background-color: lightgray} #radio_div {background-color: #FFD8B4; font-size: 40px;}",
|
|
|
|
| 97 |
return extracted_text
|
| 98 |
|
| 99 |
|
| 100 |
+
def generate_ocr(img):
|
| 101 |
|
| 102 |
text_output = ''
|
| 103 |
|
| 104 |
add_csv = []
|
| 105 |
image_id = 1
|
| 106 |
+
|
| 107 |
+
text_output = process("img", img, "fas")
|
| 108 |
|
| 109 |
if not text_output:
|
| 110 |
return text_output
|
|
|
|
| 132 |
# image = gr.Image(shape=(300, 300))
|
| 133 |
# image = gr.File(label="Upload PDF/Image")
|
| 134 |
image = gr.Image()
|
|
|
|
| 135 |
output = gr.Textbox(label="Output")
|
| 136 |
|
| 137 |
demo = gr.Interface(
|
| 138 |
generate_ocr,
|
| 139 |
+
[image],
|
| 140 |
output,
|
| 141 |
title="Persian Optical Character Recognition",
|
| 142 |
css=".gradio-container {background-color: lightgray} #radio_div {background-color: #FFD8B4; font-size: 40px;}",
|