Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import json
|
3 |
from PIL import Image
|
4 |
from surya.ocr import run_ocr
|
5 |
-
from surya.detection import
|
6 |
from surya.model.segformer import load_model as load_det_model, load_processor as load_det_processor
|
7 |
from surya.model.recognition.model import load_model as load_rec_model
|
8 |
from surya.model.recognition.processor import load_processor as load_rec_processor
|
@@ -23,7 +23,7 @@ def ocr_function(img, langs):
|
|
23 |
return img_with_text, predictions
|
24 |
|
25 |
def text_line_detection_function(img):
|
26 |
-
preds =
|
27 |
img_with_lines = draw_polys_on_image(preds["polygons"], img)
|
28 |
return img_with_lines, preds
|
29 |
|
|
|
2 |
import json
|
3 |
from PIL import Image
|
4 |
from surya.ocr import run_ocr
|
5 |
+
from surya.detection import batch_detection
|
6 |
from surya.model.segformer import load_model as load_det_model, load_processor as load_det_processor
|
7 |
from surya.model.recognition.model import load_model as load_rec_model
|
8 |
from surya.model.recognition.processor import load_processor as load_rec_processor
|
|
|
23 |
return img_with_text, predictions
|
24 |
|
25 |
def text_line_detection_function(img):
|
26 |
+
preds = batch_detection([img], det_model, det_processor)[0]
|
27 |
img_with_lines = draw_polys_on_image(preds["polygons"], img)
|
28 |
return img_with_lines, preds
|
29 |
|