AlPrompt / app.py
AlStable's picture
Update app.py
74a947f
raw
history blame
871 Bytes
from diffusers import StableDiffusionPipeline
import torch
import gradio as gr
models=[
"models/ItsJayQz/Marvel_WhatIf_Diffusion",
"models/DGSpitzer/Cyberpunk-Anime-Diffusion",
"models/DGSpitzer/Guan-Yu-Diffusion",
"models/wavymulder/portraitplus",
"models/nitrosocke/classic-anim-diffusion",
"models/22h/vintedois-diffusion-v0-1",
"models/dreamlike-art/dreamlike-diffusion-1.0",
"models/stabilityai/stable-diffusion-2-1"
]
def TextToImage(Prompt,model):
model_id = model
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
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()