Merge remote-tracking branch 'chenjix/fix_impress' into feat/aws-provider-support

This commit is contained in:
yuanmengqi
2025-06-07 17:41:50 +00:00
3 changed files with 18 additions and 7 deletions

View File

@@ -389,10 +389,22 @@ def evaluate_presentation_fill_to_rgb_distance(pptx_file, rules):
except: except:
original_rgb = None original_rgb = None
def get_rgb_from_color(color):
try:
if hasattr(color, "rgb"):
return color.rgb
else:
return None
except:
return None
def slide_fill_distance_to_rgb(_slide, _rgb, _original_rgb): def slide_fill_distance_to_rgb(_slide, _rgb, _original_rgb):
fill = _slide.background.fill fill = _slide.background.fill
if fill.type == 1: if fill.type == 1:
r1, g1, b1 = fill.fore_color.rgb color_rgb = get_rgb_from_color(fill.fore_color)
if color_rgb is None:
return 1
r1, g1, b1 = color_rgb
r2, g2, b2 = _rgb r2, g2, b2 = _rgb
if _original_rgb is not None: if _original_rgb is not None:
@@ -404,7 +416,10 @@ def evaluate_presentation_fill_to_rgb_distance(pptx_file, rules):
elif fill.type == 5: elif fill.type == 5:
master_fill = _slide.slide_layout.slide_master.background.fill master_fill = _slide.slide_layout.slide_master.background.fill
if master_fill.type == 1: if master_fill.type == 1:
r1, g1, b1 = master_fill.fore_color.rgb color_rgb = get_rgb_from_color(master_fill.fore_color)
if color_rgb is None:
return 1
r1, g1, b1 = color_rgb
else: else:
return 1 return 1
r2, g2, b2 = _rgb r2, g2, b2 = _rgb

View File

@@ -117,7 +117,7 @@ def compare_images(image1_path, image2_path, **options):
similarity_index = ssim(image1_array, image2_array) similarity_index = ssim(image1_array, image2_array)
epsilon = 0.01 epsilon = 0.01
if base_score is None: if base_score is not None:
if similarity_index >= base_score + epsilon: if similarity_index >= base_score + epsilon:
return (similarity_index - base_score) / (1 - base_score) return (similarity_index - base_score) / (1 - base_score)
else: else:

View File

@@ -653,9 +653,5 @@ You can use accerciser to check the accessibility tree on GNOME VM.
sudo apt install accerciser sudo apt install accerciser
``` ```
## [Windows](https://huggingface.co/datasets/xlangai/windows_osworld)
Coming soon...
## [MacOS](https://huggingface.co/datasets/xlangai/macos_osworld) ## [MacOS](https://huggingface.co/datasets/xlangai/macos_osworld)
Coming soon... Coming soon...