mertcobanov commited on
Commit
fdd3b76
1 Parent(s): 42dba5e

fix detailed

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,5 +1,7 @@
 
1
  from easyocr import Reader
2
  import gradio as gr
 
3
  import openai
4
  import ast
5
  import os
@@ -7,13 +9,14 @@ import os
7
  from openai_api import OpenAI_API
8
  import utils
9
 
10
-
11
  openai.api_key = os.getenv("API_KEY")
12
  reader = Reader(["tr"])
13
 
14
 
15
  def get_text(input_img):
16
- result = reader.readtext(input_img, detail=0)
 
 
17
  return " ".join(result)
18
 
19
 
 
1
+ from PIL import ImageFilter, Image
2
  from easyocr import Reader
3
  import gradio as gr
4
+ import numpy as np
5
  import openai
6
  import ast
7
  import os
 
9
  from openai_api import OpenAI_API
10
  import utils
11
 
 
12
  openai.api_key = os.getenv("API_KEY")
13
  reader = Reader(["tr"])
14
 
15
 
16
  def get_text(input_img):
17
+ img = Image.fromarray(input_img)
18
+ detailed = np.asarray(img.filter(ImageFilter.DETAIL))
19
+ result = reader.readtext(detailed, detail=0, paragraph=True)
20
  return " ".join(result)
21
 
22