Jonny001 commited on
Commit
3a6abf4
·
verified ·
1 Parent(s): 1e650a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -93,14 +93,12 @@ def upload_image(file):
93
 
94
 
95
  def image_to_base64(image: Image):
96
- # Convert the image to bytes
97
  buffered = BytesIO()
98
- image.save(buffered, format="PNG") # You can change format to PNG if needed
99
 
100
- # Encode the bytes to base64
101
  img_str = base64.b64encode(buffered.getvalue())
102
 
103
- return img_str.decode('utf-8') # Convert bytes to string
104
 
105
 
106
  with gr.Blocks() as demo:
 
93
 
94
 
95
  def image_to_base64(image: Image):
 
96
  buffered = BytesIO()
97
+ image.save(buffered, format="PNG")
98
 
 
99
  img_str = base64.b64encode(buffered.getvalue())
100
 
101
+ return img_str.decode('utf-8')
102
 
103
 
104
  with gr.Blocks() as demo: