Diego-0121 commited on
Commit
12a3b60
·
1 Parent(s): 4be3982

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
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(nunmpy ="file", label="Upload 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.",