Fix Merge Conflict - After NER: DepremOCR (PaddleOCR optimized inference pipeline)

#8
by Goodsea - opened
Files changed (2) hide show
  1. app.py +6 -5
  2. requirements.txt +10 -1
app.py CHANGED
@@ -1,12 +1,12 @@
1
  import gradio as gr
2
- from easyocr import Reader
3
- from PIL import Image
4
- import io
5
  import json
6
  import csv
7
  import openai
8
  import ast
9
  import os
 
 
10
  from deta import Deta
11
 
12
 
@@ -50,7 +50,7 @@ class OpenAI_API:
50
  ########################
51
 
52
  openai.api_key = os.getenv('API_KEY')
53
- reader = Reader(["tr"])
54
 
55
 
56
  def get_parsed_address(input_img):
@@ -66,7 +66,8 @@ def preprocess_img(inp_image):
66
 
67
 
68
  def get_text(input_img):
69
- result = reader.readtext(input_img, detail=0)
 
70
  return " ".join(result)
71
 
72
 
 
1
  import gradio as gr
2
+ from deprem_ocr.ocr import DepremOCR
 
 
3
  import json
4
  import csv
5
  import openai
6
  import ast
7
  import os
8
+ import cv2
9
+ import numpy as np
10
  from deta import Deta
11
 
12
 
 
50
  ########################
51
 
52
  openai.api_key = os.getenv('API_KEY')
53
+ depremOCR = DepremOCR()
54
 
55
 
56
  def get_parsed_address(input_img):
 
66
 
67
 
68
  def get_text(input_img):
69
+ result = depremOCR.apply_ocr(np.array(input_img))
70
+ print(result)
71
  return " ".join(result)
72
 
73
 
requirements.txt CHANGED
@@ -1,5 +1,14 @@
 
 
 
 
 
 
 
 
 
 
1
  openai
2
  Pillow
3
- easyocr
4
  gradio
5
  deta
 
1
+ paddlepaddle
2
+ opencv-python
3
+ Pillow
4
+ numpy==1.23.3
5
+ pandas
6
+ imutils
7
+ Cython
8
+ imgaug
9
+ pyclipper
10
+ deprem_ocr
11
  openai
12
  Pillow
 
13
  gradio
14
  deta