m-m / app.py
iciromaco's picture
app.py
db38d08
raw history blame
No virus
887 Bytes
#@title
import numpy as np
import gradio as gr
def inmm(init_image, prompt):
(w,h) = init_image.size
if w>h :
init_image = init_image.crop(((w - h) // 2,0,(w-h)//2 + h,h))
init_image = init_image.resize(512,512)
with autocast("cuda"):
image = pipe([prompt], num_inference_steps=50, guidance_scale=7, init_image=init_image)["sample"]
return image[0]
demo = gr.Interface(inmm, inputs=[gr.Image(shape=(512, 512),type="pil"),gr.Textbox(lines=2, placeholder="どんな絵が欲しいか",value ="a heartwarming and calming landscape drawing in <m-mi2i> style")], outputs="image",
examples=[["a_img.png", "A heartwarming Canadian wheat field scene in <m-mi2i> style, some houses, silos, and a lake in the distance"],
["c_img.png","A heartwarming Landscape on the lake, scenery mirrored on the lake, in <m-mi2i> style"]])
demo.launch()