Spaces:
Running
Running
from diffusers import StableDiffusionPipeline | |
import torch | |
modelieo=[ | |
'naclbit/trinart_stable_diffusion_v2', | |
] | |
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 | |
import gradio as gr | |
interface = gr.Interface(fn=TextToImage, | |
inputs=["text", gr.Dropdown(modelieo)], | |
outputs="image", | |
title='Text to Image') | |
interface.launch() | |