Spaces:
Runtime error
Runtime error
import gradio as gr | |
from diffusers import DiffusionPipeline | |
def generate_image(): | |
pipeline = DiffusionPipeline.from_pretrained("nroggendorff/cats") | |
pipe = pipeline.to("cuda") | |
image = pipe().images[0] | |
return image | |
css = """ | |
.gradio-container { | |
background-color: #f5f5f5; | |
padding: 2rem; | |
border-radius: 10px; | |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
} | |
.gradio-header { | |
text-align: center; | |
margin-bottom: 2rem; | |
} | |
.gradio-header h1 { | |
font-size: 2.5rem; | |
color: #333; | |
margin-bottom: 0.5rem; | |
} | |
.gradio-header p { | |
color: #666; | |
} | |
.gradio-output { | |
display: flex; | |
justify-content: center; | |
margin-top: 2rem; | |
} | |
""" | |
app = gr.Interface( | |
fn=generate_image, | |
outputs="image", | |
title="Cat Image Generator", | |
description="Click the button to generate a cute cat image.", | |
css=css, | |
examples=[["example_data/cat1.png"], ["example_data/cat2.png"]] | |
) | |
app.launch() |