Fix bugs in multiple examples

This commit is contained in:
Timothyxxx
2024-03-11 00:26:59 +08:00
parent 3f21519b78
commit b4cb64d861
2 changed files with 12 additions and 13 deletions

View File

@@ -178,6 +178,9 @@ import typing
def compare_pdf_images(pdf1_path: str, pdf2_path: str, **kwargs) -> float:
if not pdf1_path or not pdf2_path:
return 0.
def extract_images_from_pdf(pdf_path):
pdf_document = fitz.open(pdf_path)
images = []
@@ -396,16 +399,3 @@ def is_added_to_steam_cart(active_tab_info, rule):
return 0.
return 1.
if __name__ == '__main__':
result = compare_archive(
r"C:\Users\tianbaox\Desktop\DesktopEnv\cache\0e5303d4-8820-42f6-b18d-daf7e633de21\lecture_slides.zip",
r"C:\Users\tianbaox\Desktop\DesktopEnv\cache\0e5303d4-8820-42f6-b18d-daf7e633de21\gold_lecture_slides.zip",
**{
"file_path": "lecture_slides",
"file_type": "pdf"
})
print(result)

View File

@@ -387,6 +387,9 @@ def is_included_all_json_objects(gold_file_path, result_file_path):
def is_gold_text_included_in_pdf(pdf_file_path, gold_text_path):
if not gold_text_path or not pdf_file_path:
return 0
print("gold_text_path: ")
print(gold_text_path)
print("pdf_file_path: ")
@@ -447,6 +450,9 @@ def check_line_number(file_path, line_number):
def compare_terminal_and_txt(txt_file_path, terminal_output):
if not txt_file_path or not terminal_output:
return 0
# read txt file content
with open(txt_file_path, 'r') as f:
txt_file_content = f.read()
@@ -455,6 +461,9 @@ def compare_terminal_and_txt(txt_file_path, terminal_output):
def compare_python_pure_text(py_file_path, gold_file_path):
if not py_file_path or not gold_file_path:
return 0
# first, change the suffix of gold_file from .txt to .py
print("py_file_path: ")
print(py_file_path)