Functions / diffusion.py
Omnibus's picture
Update diffusion.py
4f7ca6d
raw
history blame contribute delete
582 Bytes
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))