Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -121,7 +121,8 @@ top_margin = 100
|
|
121 |
|
122 |
#out_image = put_text(improved_text, font, font_scale, color, thickness, max_width, out_image_width, top_margin)
|
123 |
|
124 |
-
def predict(
|
|
|
125 |
bin_image = preprocess_image(input_img)
|
126 |
lines = split_image_into_lines(bin_image)
|
127 |
improved_text = get_improved_result(lines)
|
@@ -130,8 +131,8 @@ def predict(input_img):
|
|
130 |
|
131 |
gradio_app = gr.Interface(
|
132 |
predict,
|
133 |
-
inputs=gr.Image(
|
134 |
-
outputs=[gr.Image(
|
135 |
title="Extract Handwritten Text",
|
136 |
)
|
137 |
|
|
|
121 |
|
122 |
#out_image = put_text(improved_text, font, font_scale, color, thickness, max_width, out_image_width, top_margin)
|
123 |
|
124 |
+
def predict(input_path):
|
125 |
+
image = cv.imread(input_path)
|
126 |
bin_image = preprocess_image(input_img)
|
127 |
lines = split_image_into_lines(bin_image)
|
128 |
improved_text = get_improved_result(lines)
|
|
|
131 |
|
132 |
gradio_app = gr.Interface(
|
133 |
predict,
|
134 |
+
inputs=gr.Image(sources=['upload', 'webcam'], type='filepath'),
|
135 |
+
outputs=[gr.Image()],
|
136 |
title="Extract Handwritten Text",
|
137 |
)
|
138 |
|