Spaces:
Runtime error
Runtime error
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| import gradio as gr | |
| import accelerate | |
| models=[ | |
| gr.Interface.load("ItsJayQz/Marvel_WhatIf_Diffusion"), | |
| gr.Interface.load("DGSpitzer/Cyberpunk-Anime-Diffusion"), | |
| gr.Interface.load("DGSpitzer/Guan-Yu-Diffusion"), | |
| gr.Interface.load("wavymulder/portraitplus"), | |
| gr.Interface.load("nitrosocke/classic-anim-diffusion"), | |
| gr.Interface.load("22h/vintedois-diffusion-v0-1"), | |
| gr.Interface.load("dreamlike-art/dreamlike-diffusion-1.0"), | |
| gr.Interface.load("stabilityai/stable-diffusion-2-1") | |
| ] | |
| def TextToImage(Prompt,model): | |
| model_id = model | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.get_default_dtype()) | |
| pipe = pipe.to("cpu") | |
| prompt = Prompt | |
| image = pipe(prompt).images[0] | |
| return image | |
| sandbox = gr.Interface(fn=TextToImage, | |
| inputs=["text", gr.Dropdown(models)], | |
| outputs="image", | |
| title='AlStable Text to Image') | |
| sandbox.launch() |