tonic commited on
Commit
cab828c
1 Parent(s): d0da7e6

initial commit

Browse files
Files changed (5) hide show
  1. api_keys.env +0 -0
  2. app.py +14 -0
  3. ayatonic.env +0 -0
  4. languages.json +0 -0
  5. requirements.txt +4 -0
api_keys.env ADDED
File without changes
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_rich_textbox import RichTextbox
3
+ from PIL import Image
4
+ from surya.ocr import run_ocr
5
+ from surya.model.detection.segformer import load_model as load_det_model, load_processor as load_det_processor
6
+ from surya.model.recognition.model import load_model as load_rec_model
7
+ from surya.model.recognition.processor import load_processor as load_rec_processor
8
+
9
+ image = Image.open(IMAGE_PATH)
10
+ langs = ["en"] # Replace with your languages
11
+ det_processor, det_model = load_det_processor(), load_det_model()
12
+ rec_model, rec_processor = load_rec_model(), load_rec_processor()
13
+
14
+ predictions = run_ocr([image], [langs], det_model, det_processor, rec_model, rec_processor)
ayatonic.env ADDED
File without changes
languages.json ADDED
File without changes
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ gradio_rich_textbox
3
+ surya-ocr
4
+ pillow