(image_path: Path)
| 548 | return buffer.getvalue() |
| 549 | |
| 550 | def encode_image_to_base64(image_path: Path) -> str: |
| 551 | |
| 552 | image_data = compress_image_if_needed(image_path) |
| 553 | encoded_string = base64.b64encode(image_data).decode('utf-8') |
| 554 | |
| 555 | if image_data.startswith(b'\xff\xd8\xff'): |
| 556 | return f"data:image/jpeg;base64,{encoded_string}" |
| 557 | else: |
| 558 | return f"data:image/png;base64,{encoded_string}" |
| 559 | |
| 560 | |
| 561 | def create_evaluation_request(difficulty: str, category: str, instruction: str, image_path:Path, |
no test coverage detected