Spaces:
Runtime error
Runtime error
Commit
·
12a3b60
1
Parent(s):
4be3982
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,6 @@ import gradio as gr
|
|
4 |
|
5 |
# ------------------------- Function to extract text from an image -------------------------
|
6 |
def extract_text_from_image(image):
|
7 |
-
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
|
8 |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Convert the image from BGR to grayscale
|
9 |
text = pytesseract.image_to_string(gray) # Extract text from the grayscale image
|
10 |
return text
|
@@ -14,7 +13,7 @@ def extract_text_from_image(image):
|
|
14 |
# Define Gradio interface
|
15 |
iface = gr.Interface(
|
16 |
fn=extract_text_from_image,
|
17 |
-
inputs=gr.Image(
|
18 |
outputs="text",
|
19 |
title="OCR APP ",
|
20 |
description="Upload an image and we'll extract the text for you.",
|
|
|
4 |
|
5 |
# ------------------------- Function to extract text from an image -------------------------
|
6 |
def extract_text_from_image(image):
|
|
|
7 |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Convert the image from BGR to grayscale
|
8 |
text = pytesseract.image_to_string(gray) # Extract text from the grayscale image
|
9 |
return text
|
|
|
13 |
# Define Gradio interface
|
14 |
iface = gr.Interface(
|
15 |
fn=extract_text_from_image,
|
16 |
+
inputs=gr.Image(type ="file", label="Upload Image"),
|
17 |
outputs="text",
|
18 |
title="OCR APP ",
|
19 |
description="Upload an image and we'll extract the text for you.",
|