sachin the king
Create app.py
75550e7 verified
raw
history blame contribute delete
852 Bytes
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()