Spaces:
Running
Running
File size: 581 Bytes
81ac59f 9d1b8e4 81ac59f 9d1b8e4 81ac59f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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()
|