ranbac commited on
Commit
639bde7
·
verified ·
1 Parent(s): afbf0ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -160,7 +160,12 @@ def predict(image):
160
  image_np = np.array(image)
161
 
162
  # 1. OCR
163
- raw_result = ocr.ocr(image_np)
 
 
 
 
 
164
 
165
  # 2. XỬ LÝ ẢNH ĐỂ VẼ (KEY FIX: Lấy ảnh từ Preprocessor nếu có)
166
  target_image_for_drawing = original_pil
 
160
  image_np = np.array(image)
161
 
162
  # 1. OCR
163
+ # Chuyển sang dùng predict() để sửa DeprecationWarning và tương thích tốt hơn với Model v5
164
+ raw_result = ocr.predict(image_np)
165
+
166
+ # Đảm bảo kết quả là list để tương thích với logic vẽ phía sau (nếu predict trả về generator/single obj)
167
+ if not isinstance(raw_result, list):
168
+ raw_result = [raw_result]
169
 
170
  # 2. XỬ LÝ ẢNH ĐỂ VẼ (KEY FIX: Lấy ảnh từ Preprocessor nếu có)
171
  target_image_for_drawing = original_pil