(image_path)
| 8 | |
| 9 | |
| 10 | def _encode_image(image_path): |
| 11 | if isinstance(image_path,Image.Image): |
| 12 | buffered = io.BytesIO() |
| 13 | image_path.save(buffered, format="JPEG") |
| 14 | img_data = buffered.getvalue() |
| 15 | base64_encoded = base64.b64encode(img_data).decode("utf-8") |
| 16 | return base64_encoded |
| 17 | else: |
| 18 | with open(image_path, "rb") as image_file: |
| 19 | return base64.b64encode(image_file.read()).decode("utf-8") |
| 20 | |
| 21 | class Qwen_VL_2_5: |
| 22 | def __init__(self, model_name="Qwen/Qwen2.5-VL-7B-Instruct"): |