added support for vision

This commit is contained in:
gilcu3
2023-11-08 17:56:27 +01:00
parent 450b86d5a7
commit 9e7d8701cd
9 changed files with 245 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ import itertools
import json
import logging
import os
import base64
import telegram
from telegram import Message, MessageEntity, Update, ChatMember, constants
@@ -376,4 +377,10 @@ def cleanup_intermediate_files(response: any):
if format == 'path':
if os.path.exists(value):
os.remove(value)
os.remove(value)
# Function to encode the image
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')