Aumkeshchy2003 commited on
Commit
12d5872
1 Parent(s): 5c30c57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  from PIL import Image
3
  import pytesseract
4
  import re
 
5
 
6
  def tesseract_ocr(filepath: str, languages: List[str]):
7
  image = Image.open(filepath)
@@ -16,6 +17,8 @@ examples = [
16
  ['examples/chi.jpg', ['HanS', 'HanT']]
17
  ]
18
 
 
 
19
  def search_and_highlight(text, keyword):
20
  highlighted_text = re.sub(f"({keyword})", r"<mark>\1</mark>", text, flags=re.IGNORECASE)
21
  return highlighted_text
 
2
  from PIL import Image
3
  import pytesseract
4
  import re
5
+ from typing import list
6
 
7
  def tesseract_ocr(filepath: str, languages: List[str]):
8
  image = Image.open(filepath)
 
17
  ['examples/chi.jpg', ['HanS', 'HanT']]
18
  ]
19
 
20
+ language_choices = pytesseract.get_languages()
21
+
22
  def search_and_highlight(text, keyword):
23
  highlighted_text = re.sub(f"({keyword})", r"<mark>\1</mark>", text, flags=re.IGNORECASE)
24
  return highlighted_text