genelify commited on
Commit
e05e288
·
verified ·
1 Parent(s): da59e8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,10 +1,11 @@
1
- import gradio as gr, pytesseract, cv2, numpy as np
2
  from PIL import Image, ImageDraw
3
 
4
  def process(image_path: str, lang: str) -> list[Image.Image, str]:
5
 
6
  with Image.open(image_path).convert('RGB') as image_data:
7
-
 
8
  gray = cv2.cvtColor(np.array(image_data), cv2.COLOR_BGR2GRAY)
9
  _,threshold = cv2.threshold(gray, 127, 255, cv2.THRESH_TOZERO)
10
  data = pytesseract.image_to_data(threshold, output_type=pytesseract.Output.DICT, lang=lang)
 
1
+ import gradio as gr, pytesseract, cv2, numpy as np, os
2
  from PIL import Image, ImageDraw
3
 
4
  def process(image_path: str, lang: str) -> list[Image.Image, str]:
5
 
6
  with Image.open(image_path).convert('RGB') as image_data:
7
+
8
+ os.remove(image_path)
9
  gray = cv2.cvtColor(np.array(image_data), cv2.COLOR_BGR2GRAY)
10
  _,threshold = cv2.threshold(gray, 127, 255, cv2.THRESH_TOZERO)
11
  data = pytesseract.image_to_data(threshold, output_type=pytesseract.Output.DICT, lang=lang)