Merge branch 'rednote-hilab:master' into master

This commit is contained in:
MrrDrr
2025-09-10 21:32:00 +08:00
committed by GitHub
4 changed files with 2788 additions and 7 deletions
+1 -1
View File
@@ -260,7 +260,7 @@ def process_image_inference_with_annotation(annotation_data, test_image_input,
if image is None: if image is None:
return None, "Please select a test image or add an image in the annotation component", "", "", gr.update(value=None), "" return None, "Please select a test image or add an image in the annotation component", "", "", gr.update(value=None), ""
if bbox is None: if bbox is None:
return "Please select a bounding box by mouse", "Please select a bounding box by mouse", "", "", gr.update(value=None) return None, "Please select a bounding box by mouse", "Please select a bounding box by mouse", "", "", gr.update(value=None)
try: try:
# Process using DotsOCRParser, passing the bbox parameter # Process using DotsOCRParser, passing the bbox parameter
File diff suppressed because it is too large Load Diff
-5
View File
@@ -1,8 +1,3 @@
import json
import io
import base64
import math
from PIL import Image
import requests import requests
from dots_ocr.utils.image_utils import PILimage_to_base64 from dots_ocr.utils.image_utils import PILimage_to_base64
from openai import OpenAI from openai import OpenAI
+1 -1
View File
@@ -156,7 +156,7 @@ class DotsOCRParser:
min_pixels = min_pixels or MIN_PIXELS # preprocess image to the final input min_pixels = min_pixels or MIN_PIXELS # preprocess image to the final input
max_pixels = max_pixels or MAX_PIXELS max_pixels = max_pixels or MAX_PIXELS
if min_pixels is not None: assert min_pixels >= MIN_PIXELS, f"min_pixels should >= {MIN_PIXELS}" if min_pixels is not None: assert min_pixels >= MIN_PIXELS, f"min_pixels should >= {MIN_PIXELS}"
if max_pixels is not None: assert max_pixels <= MAX_PIXELS, f"max_pixels should <+ {MAX_PIXELS}" if max_pixels is not None: assert max_pixels <= MAX_PIXELS, f"max_pixels should <= {MAX_PIXELS}"
if source == 'image' and fitz_preprocess: if source == 'image' and fitz_preprocess:
image = get_image_by_fitz_doc(origin_image, target_dpi=self.dpi) image = get_image_by_fitz_doc(origin_image, target_dpi=self.dpi)