Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ def encode_image_to_base64(image):
|
|
68 |
image.save(buffered, format="PNG") # Use PNG for compatibility with RGBA
|
69 |
return base64.b64encode(buffered.getvalue()).decode('utf-8')
|
70 |
|
71 |
-
def
|
72 |
# Vérifie si l'image est en base64 ou URL
|
73 |
if image_data.startswith('http://') or image_data.startswith('https://'):
|
74 |
return get_image_from_url(image_data) # Télécharge l'image depuis l'URL
|
@@ -101,7 +101,7 @@ def process_api_vision():
|
|
101 |
data = request.json
|
102 |
image = data['image']
|
103 |
prompt = data['prompt']
|
104 |
-
image =
|
105 |
result = process_vision(image,prompt)
|
106 |
|
107 |
# Remove ```json and ``` markers
|
|
|
68 |
image.save(buffered, format="PNG") # Use PNG for compatibility with RGBA
|
69 |
return base64.b64encode(buffered.getvalue()).decode('utf-8')
|
70 |
|
71 |
+
def extract_image(image_data):
|
72 |
# Vérifie si l'image est en base64 ou URL
|
73 |
if image_data.startswith('http://') or image_data.startswith('https://'):
|
74 |
return get_image_from_url(image_data) # Télécharge l'image depuis l'URL
|
|
|
101 |
data = request.json
|
102 |
image = data['image']
|
103 |
prompt = data['prompt']
|
104 |
+
image = extract_image(image)
|
105 |
result = process_vision(image,prompt)
|
106 |
|
107 |
# Remove ```json and ``` markers
|