Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,6 @@ model = VisionEncoderDecoderModel.from_pretrained(model_name)
|
|
17 |
def recognize_handwriting(image):
|
18 |
try:
|
19 |
logger.info("Received an image for handwriting recognition.")
|
20 |
-
if isinstance(image, dict):
|
21 |
-
image = image.get("image")
|
22 |
|
23 |
if image is None:
|
24 |
logger.error("No image found in the input.")
|
@@ -39,7 +37,7 @@ with gr.Blocks() as demo:
|
|
39 |
gr.Markdown("## Handwritten Text Recognition")
|
40 |
with gr.Row():
|
41 |
with gr.Column():
|
42 |
-
image_input = gr.Image(tool="
|
43 |
submit_button = gr.Button("Submit")
|
44 |
with gr.Column():
|
45 |
output_text = gr.Textbox(label="Recognized Text")
|
@@ -48,4 +46,4 @@ with gr.Blocks() as demo:
|
|
48 |
|
49 |
# Launch the app
|
50 |
if __name__ == "__main__":
|
51 |
-
demo.launch()
|
|
|
17 |
def recognize_handwriting(image):
|
18 |
try:
|
19 |
logger.info("Received an image for handwriting recognition.")
|
|
|
|
|
20 |
|
21 |
if image is None:
|
22 |
logger.error("No image found in the input.")
|
|
|
37 |
gr.Markdown("## Handwritten Text Recognition")
|
38 |
with gr.Row():
|
39 |
with gr.Column():
|
40 |
+
image_input = gr.Image(tool="sketch", type="numpy", label="Draw or Upload an Image")
|
41 |
submit_button = gr.Button("Submit")
|
42 |
with gr.Column():
|
43 |
output_text = gr.Textbox(label="Recognized Text")
|
|
|
46 |
|
47 |
# Launch the app
|
48 |
if __name__ == "__main__":
|
49 |
+
demo.launch()
|