| from diffusers import StableDiffusionPipeline | |
| import torch | |
| import gradio as gr | |
| model_name = 'nitrosocke/Arcane-Diffusion' # Choose one model from your list | |
| def TextToImage(Prompt, model_name): | |
| pipe = StableDiffusionPipeline.from_pretrained(model_name, torch_dtype=torch.float16) | |
| pipe = pipe.to("cpu") | |
| prompt = Prompt | |
| image = pipe(prompt).images[0] | |
| return image | |
| interface = gr.Interface(fn=TextToImage, | |
| inputs=["text", gr.inputs.Text()], # Use gr.inputs.Text() here | |
| outputs="image", | |
| title='Text to Image', | |
| live=True) | |
| interface.launch() | |