Spaces:
Runtime error
Runtime error
File size: 852 Bytes
75550e7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from transformers.utils import move_cache
move_cache()
from diffusers import StableDiffusionPipeline
import torch
import gradio as gr
get_completion = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
def texttoImage(input):
output = get_completion(input)
return output.images[0]
demo = gr.Interface(fn=texttoImage,
inputs=[gr.Textbox(label="Your prompt")],
outputs=[gr.Image(label="Result")],
title="Image Generation with Stable Diffusion",
description="Generate any image with Stable Diffusion",
allow_flagging="never",
examples=["the spirit of a tamagotchi wandering in the city of Vienna",
"a mecha robot in a favela"])
demo.launch() |