Vihang28 commited on
Commit
2021fd6
·
verified ·
1 Parent(s): 21e1b76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
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 = concate_image(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