File size: 1,023 Bytes
72f0ef3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()