(image_path: Path)
| 516 | return buffer.getvalue() |
| 517 | |
| 518 | def encode_image_to_base64(image_path: Path) -> str: |
| 519 | |
| 520 | image_data = compress_image_if_needed(image_path) |
| 521 | encoded_string = base64.b64encode(image_data).decode('utf-8') |
| 522 | |
| 523 | if image_data.startswith(b'\xff\xd8\xff'): |
| 524 | return f"data:image/jpeg;base64,{encoded_string}" |
| 525 | else: |
| 526 | return f"data:image/png;base64,{encoded_string}" |
| 527 | |
| 528 | |
| 529 | def create_evaluation_request(difficulty: str, category: str, instruction: str, image_path:Path, |
no test coverage detected