Spaces:
No application file
No application file
File size: 582 Bytes
0533273 e8d908f 0533273 e8d908f 25bbd1e 0533273 4f7ca6d 0533273 e8d908f 4f7ca6d e8d908f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import gradio as gr
from PIL import Image
import io
def im_2_bytes(img_path):
pil_im=Image.open(img_path)
b = io.BytesIO()
pil_im.save(b, 'png')
im = b.getvalue()
return (im)
def gen_image(prompt,model_name="dreamlike-art/dreamlike-photoreal-2.0",count = 1):
proc=gr.load(f"models/{model_name}")
output=proc(f'{prompt}')
'''
t=0
output_list=[]
while t<int(count):
output=proc(prompt)
output_list.append(output)
inputs=f"{inputs} "
t+=1
#return(output_list)
'''
return(im_2_bytes(output))
|