Omnibus commited on
Commit
e8d908f
·
1 Parent(s): 25bbd1e

Update diffusion.py

Browse files
Files changed (1) hide show
  1. diffusion.py +11 -1
diffusion.py CHANGED
@@ -1,5 +1,13 @@
1
  import gradio as gr
 
 
2
 
 
 
 
 
 
 
3
  def gen_image(prompt,model_name="dreamlike-art/dreamlike-photoreal-2.0",count = 1):
4
  proc=gr.load(f"models/{model_name}")
5
  t=0
@@ -9,4 +17,6 @@ def gen_image(prompt,model_name="dreamlike-art/dreamlike-photoreal-2.0",count =
9
  output_list.append(output)
10
  inputs=f"{inputs} "
11
  t+=1
12
- return(output_list)
 
 
 
1
  import gradio as gr
2
+ from PIL import Image
3
+ import io
4
 
5
+ def im_2_bytes(img_path):
6
+ pil_im=Image.open(img_path)
7
+ b = io.BytesIO()
8
+ pil_im.save(b, 'png')
9
+ im = b.getvalue()
10
+ return (im)
11
  def gen_image(prompt,model_name="dreamlike-art/dreamlike-photoreal-2.0",count = 1):
12
  proc=gr.load(f"models/{model_name}")
13
  t=0
 
17
  output_list.append(output)
18
  inputs=f"{inputs} "
19
  t+=1
20
+ #return(output_list)
21
+ return(im_2_bytes(output))
22
+