GenAIJake's picture
Update app.py
5e8eb3e verified
raw
history blame
1.27 kB
import gradio as gr
import spaces
@spaces.GPU
def generate_image(prompt, negative_prompt="", seed=42, width=512, height=512, guidance_scale=3.5, num_inference_steps=20):
# This function will be called by gr.load(), so we don't need to implement it here
pass
examples = [
["d3xt3r dachshund as a camp counselor in the woods."],
["d3xt3r dachshund dressed as batman"],
["d3xt3r dachshund in a suit and tie"],
]
# Create the Gradio interface
demo = gr.Interface(
fn=generate_image,
inputs=[
gr.Textbox(label="Prompt"),
gr.Textbox(label="Negative Prompt", value=""),
gr.Slider(label="Seed", minimum=0, maximum=10000, step=1, value=42),
gr.Slider(label="Width", minimum=64, maximum=1024, step=64, value=512),
gr.Slider(label="Height", minimum=64, maximum=1024, step=64, value=512),
gr.Slider(label="Guidance Scale", minimum=0.0, maximum=10.0, step=0.1, value=3.5),
gr.Slider(label="Number of Inference Steps", minimum=1, maximum=100, step=1, value=20)
],
outputs="image",
examples=examples,
title="D3XT3R Dachshund Image Generator",
description="Generate images of D3XT3R the Dachshund with various prompts.",
)
# Add GPUZero functionality
demo.queue()
demo.launch()