File size: 2,301 Bytes
66b0cef
160cf01
66b0cef
e816365
8a42a65
5808f1f
 
 
51f8fc2
b060071
147944d
51f8fc2
 
 
 
147944d
bce0716
04a1a68
3901554
04a1a68
 
 
 
 
b060071
8ef39e7
3901554
04a1a68
3901554
 
 
 
04a1a68
b060071
 
3901554
 
 
 
 
 
 
b060071
 
3901554
 
 
 
 
04a1a68
 
 
3901554
b060071
 
3901554
 
04a1a68
 
b060071
 
04a1a68
71bb213
04a1a68
 
 
71bb213
 
04a1a68
71bb213
 
 
 
890a58c
 
04a1a68
 
71bb213
 
3901554
 
73a0c03
 
 
04a1a68
b060071
73a0c03
3901554
51f8fc2
3901554
04a1a68
73a0c03
 
160cf01
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import gradio as gr
import random

model = gr.load("models/Purz/face-projection")

def generate_image(text, seed):
    if seed is not None:
        random.seed(seed)
    return model(text)

examples = [
    ["Humanoid Cat Warrior, Full View", None],
    ["Warhammer Sisterhood", None],
    ["Future Robots war", None],
    ["Fantasy dragon", None]
]

# Custom CSS for minimalist style, horizontal example layout, and simple buttons
custom_css = """
/* Remove border and background color for the output image preview */
.output-image {
    border: none !important;
    background: none !important;
}

/* Prompt textbox styling */
input[type="text"] {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    width: 100%;
    background-color: #f9f9f9;
}

/* Examples arranged in a single line, without buttons */
.gr-examples {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    gap: 10px;
    margin-top: 10px;
}

.gr-examples span {
    font-size: 14px;
    color: #333;
    cursor: pointer;
    padding: 5px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: all 0.2s ease;
}

/* Hover effect on examples */
.gr-examples span:hover {
    background-color: #e7e7e7;
    color: #333;
}

/* Styling for all buttons with simple design */
button {
    border-radius: 8px;
    background-color: #f0f0f0; /* Simple gray background */
    color: #333;
    font-weight: bold;
    padding: 10px 20px;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
}

button:hover {
    background-color: #e0e0e0; /* Slightly darker on hover */
    color: #333;
}
"""

# Gradio Interface with updated UI elements and custom CSS
interface = gr.Interface(
    fn=generate_image,
    inputs=[
        gr.Textbox(label="Imagine anything:", placeholder="Describe the scene...", interactive=True),
        gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)")
    ],
    outputs=gr.Image(label="Generated Image", type="pil"),
    examples=examples,
    css=custom_css,  # Apply custom CSS
    description="Enter a creative prompt or choose an example to generate your AI-powered image. Model performance may vary due to CPU usage.",
)

interface.launch()