Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,8 +34,13 @@ def concate_image(img_input):
|
|
| 34 |
cv2.imwrite('merge_image.jpg', im_v)
|
| 35 |
return "merge_image.jpg"
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
def api_calling(image, prompt, api_key):
|
| 38 |
-
base64_image =
|
| 39 |
if len(prompt) == 0:
|
| 40 |
prompt = "Provide a brief description of the image."
|
| 41 |
|
|
|
|
| 34 |
cv2.imwrite('merge_image.jpg', im_v)
|
| 35 |
return "merge_image.jpg"
|
| 36 |
|
| 37 |
+
def encode_image(image_path):
|
| 38 |
+
file_path = concate_image(image_path)
|
| 39 |
+
with open(file_path, "rb") as image_file:
|
| 40 |
+
return base64.b64encode(image_file.read()).decode('utf-8')
|
| 41 |
+
|
| 42 |
def api_calling(image, prompt, api_key):
|
| 43 |
+
base64_image = encode_image(image)
|
| 44 |
if len(prompt) == 0:
|
| 45 |
prompt = "Provide a brief description of the image."
|
| 46 |
|