tommy24 commited on
Commit
483dac4
·
1 Parent(s): e3bad66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -761,6 +761,12 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
761
  else:
762
  pass
763
 
 
 
 
 
 
 
764
  def vision():
765
  with open("image.png", "wb") as file1_write:
766
  file1_write.write(image_data)
 
761
  else:
762
  pass
763
 
764
+ def encode_image(image: Image.Image, format: str = "PNG") -> str:
765
+ with io.BytesIO() as buffer:
766
+ image.save(buffer, format=format)
767
+ encoded_image = base64.b64encode(buffer.getvalue()).decode("utf-8")
768
+ return encoded_image
769
+
770
  def vision():
771
  with open("image.png", "wb") as file1_write:
772
  file1_write.write(image_data)