|
import gradio as gr |
|
from diffusers import StableDiffusionPipeline |
|
import torch |
|
|
|
pipe = StableDiffusionPipeline.from_pretrained("MohamedRashad/diffusion_fashion", torch_dtype=torch.float32) |
|
pipe.to("cpu") |
|
|
|
def generate_image(text): |
|
images = pipe(text).images |
|
image = images[0] |
|
return image |
|
|
|
diffusion_interface = gr.Interface( |
|
generate_image, |
|
gr.Textbox(lines=1, label="Input"), |
|
gr.Image(type="pil", label="Output"), |
|
title="Diffusion4Fashion: Generate cool clothes!", |
|
description="<center><p>Enter a description about a piece of cloth and the model will generate an image.</p></center>", |
|
examples=["A photo of a dress, made in 2019, color is Red, Casual usage, Women's cloth, something for the summer season, on white background"], |
|
) |
|
|
|
diffusion_interface.launch() |