patch: minor bug fixes for evaluator and task configurations, documentation update (#121)

* fix: /cursor_position api return format fix

* chore: update README.md to remove deprecated command

* fix: add base score for evaluators and minor bug fixes

* fix: add base score for setup configurations

---------

Co-authored-by: Jiaqi Deng <jiaqideng@Jiaqis-MacBook-Pro.local>
This commit is contained in:
MillanK
2025-01-18 22:25:18 +08:00
committed by GitHub
parent 89426951c9
commit 983283a86a
13 changed files with 115 additions and 20 deletions

View File

@@ -83,7 +83,7 @@ def is_vlc_fullscreen(actual_window_size, screen_size):
return 0
def compare_images(image1_path, image2_path):
def compare_images(image1_path, image2_path, **options):
# You would call this function with the paths to the two images you want to compare:
# score = compare_images('path_to_image1', 'path_to_image2')
# print("Similarity score:", score)
@@ -91,6 +91,8 @@ def compare_images(image1_path, image2_path):
if not image1_path or not image2_path:
return 0
base_score = options.get("reference_base_result", None)
# Open the images and convert to grayscale
image1 = Image.open(image1_path).convert('L')
image2 = Image.open(image2_path).convert('L')
@@ -110,8 +112,14 @@ def compare_images(image1_path, image2_path):
# Calculate SSIM between two images
similarity_index = ssim(image1_array, image2_array)
return similarity_index
epsilon = 0.01
if base_score is None:
if similarity_index >= base_score + epsilon:
return (similarity_index - base_score) / (1 - base_score)
else:
return 0
else:
return similarity_index
def compare_audios(audio_path_1, audio_path_2):
"""