fffiloni commited on
Commit
b8b5ea2
1 Parent(s): b13c1ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  #from torch import autocast // only for GPU
4
 
5
  from PIL import Image
6
-
7
  import os
8
  MY_SECRET_TOKEN=os.environ.get('HF_TOKEN_SD')
9
 
@@ -22,7 +22,7 @@ pipe.to(device)
22
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
23
 
24
  def infer(prompt, init_image):
25
- init_image = Image.open(init_image).convert("RGB")
26
  init_image = init_image.resize((512, 512))
27
  #image = pipe(prompt, init_image=init_image)["sample"][0]
28
  images_list = pipe([prompt] * 2, init_image=init_image, strength=0.75)
 
3
  #from torch import autocast // only for GPU
4
 
5
  from PIL import Image
6
+ from io import BytesIO
7
  import os
8
  MY_SECRET_TOKEN=os.environ.get('HF_TOKEN_SD')
9
 
 
22
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
23
 
24
  def infer(prompt, init_image):
25
+ init_image = Image.open(BytesIO(init_image)).convert("RGB")
26
  init_image = init_image.resize((512, 512))
27
  #image = pipe(prompt, init_image=init_image)["sample"][0]
28
  images_list = pipe([prompt] * 2, init_image=init_image, strength=0.75)