Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -50,7 +50,7 @@ def detect_and_ocr(image):
|
|
50 |
image = Image.fromarray(image)
|
51 |
original_image = image.copy()
|
52 |
|
53 |
-
results = model.predict(image, conf=0.
|
54 |
detected_boxes = results[0].boxes.xyxy.tolist()
|
55 |
detected_boxes = [list(map(int, box)) for box in detected_boxes]
|
56 |
|
@@ -67,7 +67,7 @@ def detect_and_ocr(image):
|
|
67 |
|
68 |
if check_tesseract(): # If Tesseract is installed, run OCR
|
69 |
try:
|
70 |
-
ocr_text = pytesseract.image_to_string(cropped_line, lang="khm
|
71 |
if ocr_text:
|
72 |
extracted_text_lines.append(ocr_text)
|
73 |
except Exception as e:
|
|
|
50 |
image = Image.fromarray(image)
|
51 |
original_image = image.copy()
|
52 |
|
53 |
+
results = model.predict(image, conf=0.1, iou=0.2, device="cpu")
|
54 |
detected_boxes = results[0].boxes.xyxy.tolist()
|
55 |
detected_boxes = [list(map(int, box)) for box in detected_boxes]
|
56 |
|
|
|
67 |
|
68 |
if check_tesseract(): # If Tesseract is installed, run OCR
|
69 |
try:
|
70 |
+
ocr_text = pytesseract.image_to_string(cropped_line, lang="khm","eng").strip()
|
71 |
if ocr_text:
|
72 |
extracted_text_lines.append(ocr_text)
|
73 |
except Exception as e:
|