import gradio as gr from PIL import Image from pathlib import Path from multiprocessing import cpu_count import requests import io import os from PIL import Image from diffusers import ( DiffusionPipeline, StableDiffusionPipeline, StableDiffusionControlNetImg2ImgPipeline, ControlNetModel, DDIMScheduler, DPMSolverMultistepScheduler, DEISMultistepScheduler, HeunDiscreteScheduler, EulerDiscreteScheduler, ) pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5") def generate(prompt): return pipeline(prompt) iface = gr.Interface(fn=generate, inputs="text", outputs="image") iface.launch()