Spaces:
Runtime error
Runtime error
File size: 1,002 Bytes
cbdd327 |
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 |
import gradio as gr
from diffusers import DiffusionPipeline
# get_completion = pipeline("image-to-text",model="nlpconnect/vit-gpt2-image-captioning")
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
# def summarize(input):
# output = get_completion(input)
# return output[0]['generated_text']
# def captioner(image):
# result = get_completion(image)
# return result[0]['generated_text']
def generate(prompt):
return pipeline(prompt).images[0]
gr.close_all()
demo = gr.Interface(fn=generate,
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() |