Spaces:
Runtime error
Runtime error
File size: 639 Bytes
1dae4c8 b87fd0f 1dae4c8 b87fd0f 1dae4c8 |
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 28 |
from diffusers import StableDiffusionPipeline
import torch
import gradio as gr
import random
fseed=random.random()
model="models/nan2/lcbanner"
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
interface = gr.Interface(fn=TextToImage,
inputs=["text", "nan2/lcbanner"],
outputs="image",
title='Text to Image')
interface.launch()
#gr.Interface.load("models/nan2/lcbanner").launch() |