mrestrepo commited on
Commit
5bc3d3e
·
1 Parent(s): 377836b

Convert webp in jpeg

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,10 +1,10 @@
 
 
1
  import spaces
2
  import gradio as gr
3
  import numpy as np
4
  from diffusers import AutoPipelineForText2Image
5
- import torch
6
  from huggingface_hub import snapshot_download
7
- from io import BytesIO
8
  from PIL import Image
9
 
10
  SPACE_USERNAME = 'KR_4dmin'
@@ -35,11 +35,11 @@ def infer(prompt, height, width, guidance_scale, num_inference_steps):
35
  ).images[0]
36
 
37
  # Convert the image to JPG format
38
- img_byte_arr = BytesIO()
39
- image.save(img_byte_arr, format='JPEG')
40
- image_jpg = img_byte_arr.getvalue()
41
 
42
- return image_jpg
43
 
44
 
45
  examples = [
 
1
+ import torch
2
+ import io
3
  import spaces
4
  import gradio as gr
5
  import numpy as np
6
  from diffusers import AutoPipelineForText2Image
 
7
  from huggingface_hub import snapshot_download
 
8
  from PIL import Image
9
 
10
  SPACE_USERNAME = 'KR_4dmin'
 
35
  ).images[0]
36
 
37
  # Convert the image to JPG format
38
+ buffered = io.BytesIO()
39
+ image.save(buffered, format="JPEG")
40
+ jpeg_image = buffered.getvalue()
41
 
42
+ return jpeg_image
43
 
44
 
45
  examples = [