Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import cv2
|
3 |
import easyocr
|
4 |
from PIL import Image
|
|
|
5 |
|
6 |
# Functions for OCR steps
|
7 |
def get_grayscale(image):
|
@@ -108,9 +109,12 @@ Optical Character Recognition (OCR) is a technology used to convert different ty
|
|
108 |
Please upload an image and select the correct order of steps to perform OCR. You can also adjust the threshold value using the slider.
|
109 |
"""
|
110 |
|
111 |
-
example_image_path = "
|
112 |
|
113 |
-
|
|
|
|
|
|
|
114 |
steps = gr.CheckboxGroup(choices=tutorial_steps, label="Select and order the steps for OCR")
|
115 |
threshold = gr.Slider(0, 255, value=127, step=1, label="Threshold Value")
|
116 |
output = gr.Textbox(label="OCR Output")
|
@@ -133,4 +137,3 @@ quiz_app = gr.TabbedInterface(
|
|
133 |
|
134 |
quiz_app.launch()
|
135 |
|
136 |
-
|
|
|
2 |
import cv2
|
3 |
import easyocr
|
4 |
from PIL import Image
|
5 |
+
import numpy as np
|
6 |
|
7 |
# Functions for OCR steps
|
8 |
def get_grayscale(image):
|
|
|
109 |
Please upload an image and select the correct order of steps to perform OCR. You can also adjust the threshold value using the slider.
|
110 |
"""
|
111 |
|
112 |
+
example_image_path = "example_image.png" # Provide the path to your example image
|
113 |
|
114 |
+
# Load the example image
|
115 |
+
example_image = np.array(Image.open(example_image_path))
|
116 |
+
|
117 |
+
image = gr.Image(value=example_image, label="Upload or edit image for OCR")
|
118 |
steps = gr.CheckboxGroup(choices=tutorial_steps, label="Select and order the steps for OCR")
|
119 |
threshold = gr.Slider(0, 255, value=127, step=1, label="Threshold Value")
|
120 |
output = gr.Textbox(label="OCR Output")
|
|
|
137 |
|
138 |
quiz_app.launch()
|
139 |
|
|