heecheol.park commited on
Commit
fc03749
Β·
1 Parent(s): 6f8483f

feat: support Korean text recognition in OCR

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. packages.txt +1 -0
app.py CHANGED
@@ -6,9 +6,10 @@ from PIL import Image
6
 
7
  def ocr_image_to_text(image: Image.Image):
8
  image_cv = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
9
- text = pytesseract.image_to_string(image_cv)
10
  return text
11
 
 
12
  # Gradio μΈν„°νŽ˜μ΄μŠ€λ₯Ό μ •μ˜ν•©λ‹ˆλ‹€.
13
  image_input = gr.inputs.Image(label="Upload an image")
14
  text_output = gr.outputs.Textbox(label="Extracted Text")
 
6
 
7
  def ocr_image_to_text(image: Image.Image):
8
  image_cv = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
9
+ text = pytesseract.image_to_string(image_cv, lang='eng+kor')
10
  return text
11
 
12
+
13
  # Gradio μΈν„°νŽ˜μ΄μŠ€λ₯Ό μ •μ˜ν•©λ‹ˆλ‹€.
14
  image_input = gr.inputs.Image(label="Upload an image")
15
  text_output = gr.outputs.Textbox(label="Extracted Text")
packages.txt CHANGED
@@ -1,2 +1,3 @@
1
  tesseract-ocr
2
  libtesseract-dev
 
 
1
  tesseract-ocr
2
  libtesseract-dev
3
+ tesseract-ocr-kor