Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,8 @@ import cv2
|
|
4 |
import numpy as np
|
5 |
from PIL import Image, ImageEnhance
|
6 |
from ultralytics import YOLO
|
7 |
-
from
|
8 |
-
from
|
9 |
-
import torchvision.transforms as T
|
10 |
-
from decord import VideoReader, cpu
|
11 |
-
|
12 |
|
13 |
model_path = "best.pt"
|
14 |
model = YOLO(model_path)
|
@@ -82,12 +79,13 @@ def crop_image(image, bounding_boxes):
|
|
82 |
|
83 |
|
84 |
def vision_ai_api(image, doc_type):
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
91 |
|
92 |
|
93 |
def predict(image):
|
|
|
4 |
import numpy as np
|
5 |
from PIL import Image, ImageEnhance
|
6 |
from ultralytics import YOLO
|
7 |
+
from backPrompt import main as main_b
|
8 |
+
from frontPrompt import main as main_f
|
|
|
|
|
|
|
9 |
|
10 |
model_path = "best.pt"
|
11 |
model = YOLO(model_path)
|
|
|
79 |
|
80 |
|
81 |
def vision_ai_api(image, doc_type):
|
82 |
+
|
83 |
+
if doc_type == "front":
|
84 |
+
results = main_f(image)
|
85 |
+
if doc_type == "back":
|
86 |
+
results = main_b(image)
|
87 |
+
|
88 |
+
return results
|
89 |
|
90 |
|
91 |
def predict(image):
|