nroggendorff commited on
Commit
72f0ef3
·
verified ·
1 Parent(s): b10c0d4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -0
app.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
+
4
+ def generate_image():
5
+ pipeline = DiffusionPipeline.from_pretrained("nroggendorff/cats")
6
+ pipe = pipeline.to("cuda")
7
+ image = pipe().images[0]
8
+ return image
9
+
10
+ css = """
11
+ .gradio-container {
12
+ background-color: #f5f5f5;
13
+ padding: 2rem;
14
+ border-radius: 10px;
15
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
16
+ }
17
+ .gradio-header {
18
+ text-align: center;
19
+ margin-bottom: 2rem;
20
+ }
21
+ .gradio-header h1 {
22
+ font-size: 2.5rem;
23
+ color: #333;
24
+ margin-bottom: 0.5rem;
25
+ }
26
+ .gradio-header p {
27
+ color: #666;
28
+ }
29
+ .gradio-output {
30
+ display: flex;
31
+ justify-content: center;
32
+ margin-top: 2rem;
33
+ }
34
+ """
35
+
36
+ app = gr.Interface(
37
+ fn=generate_image,
38
+ outputs="image",
39
+ title="Cat Image Generator",
40
+ description="Click the button to generate a cute cat image.",
41
+ css=css,
42
+ examples=[["example_data/cat1.png"], ["example_data/cat2.png"]]
43
+ )
44
+ app.launch()