Improve Space UI hero section
Browse files
app.py
CHANGED
|
@@ -3,38 +3,112 @@ import requests
|
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
#solricks-hero {
|
| 7 |
-
background:
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
color: white;
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
}
|
| 14 |
|
| 15 |
#solricks-hero h1 {
|
| 16 |
-
margin: 0 0
|
| 17 |
color: white;
|
| 18 |
-
font-size:
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
}
|
| 21 |
|
| 22 |
#solricks-hero p {
|
| 23 |
margin: 0;
|
|
|
|
| 24 |
font-size: 15px;
|
| 25 |
-
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
-
#solricks-note {
|
| 29 |
-
display:
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
border-radius: 999px;
|
| 33 |
-
background: rgba(255,255,255,0.
|
| 34 |
-
color:
|
| 35 |
font-size: 13px;
|
| 36 |
-
font-weight:
|
| 37 |
-
border: 1px solid rgba(255,255,255,0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
"""
|
| 40 |
|
|
@@ -105,7 +179,7 @@ def generate_image(prompt, style, resolution):
|
|
| 105 |
if image_url.startswith("/"):
|
| 106 |
image_url = f"{API_BASE_URL}{image_url}"
|
| 107 |
|
| 108 |
-
return image_url, "Done."
|
| 109 |
|
| 110 |
except requests.exceptions.Timeout:
|
| 111 |
return None, "Generation timed out. Please try again."
|
|
@@ -113,65 +187,101 @@ def generate_image(prompt, style, resolution):
|
|
| 113 |
return None, f"Error: {error}"
|
| 114 |
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
with gr.Blocks(
|
| 117 |
title="SOLRICKS Image Generator",
|
|
|
|
| 118 |
css=custom_css,
|
| 119 |
) as demo:
|
| 120 |
gr.Markdown(
|
| 121 |
"""
|
| 122 |
<div id="solricks-hero">
|
|
|
|
| 123 |
<h1>SOLRICKS Image Generator</h1>
|
| 124 |
-
<p>
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
</div>
|
| 127 |
"""
|
| 128 |
)
|
| 129 |
|
| 130 |
-
prompt = gr.Textbox(
|
| 131 |
-
label="Prompt",
|
| 132 |
-
placeholder="Describe the image you want to generate...",
|
| 133 |
-
lines=4,
|
| 134 |
-
max_lines=6,
|
| 135 |
-
)
|
| 136 |
-
|
| 137 |
with gr.Row():
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
gr.Examples(
|
| 162 |
examples=[
|
| 163 |
[
|
| 164 |
-
"cinematic portrait of a futuristic
|
| 165 |
"Portrait",
|
| 166 |
"768x1344",
|
| 167 |
],
|
| 168 |
[
|
| 169 |
-
"luxury product photo of a perfume bottle
|
| 170 |
"Product",
|
| 171 |
"1024x1024",
|
| 172 |
],
|
| 173 |
[
|
| 174 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
"Cinematic",
|
| 176 |
"1344x768",
|
| 177 |
],
|
|
@@ -179,6 +289,21 @@ with gr.Blocks(
|
|
| 179 |
inputs=[prompt, style, resolution],
|
| 180 |
)
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
generate_button.click(
|
| 183 |
fn=generate_image,
|
| 184 |
inputs=[prompt, style, resolution],
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
custom_css = """
|
| 6 |
+
.gradio-container {
|
| 7 |
+
max-width: 1180px !important;
|
| 8 |
+
margin: 0 auto !important;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
#solricks-hero {
|
| 12 |
+
background:
|
| 13 |
+
radial-gradient(circle at 80% 20%, rgba(96, 165, 250, 0.28), transparent 32%),
|
| 14 |
+
radial-gradient(circle at 10% 0%, rgba(124, 58, 237, 0.25), transparent 34%),
|
| 15 |
+
linear-gradient(135deg, #070814 0%, #111827 45%, #1e1b4b 100%);
|
| 16 |
+
padding: 30px;
|
| 17 |
+
border-radius: 22px;
|
| 18 |
+
margin-bottom: 22px;
|
| 19 |
color: white;
|
| 20 |
+
border: 1px solid rgba(255,255,255,0.12);
|
| 21 |
+
box-shadow: 0 18px 55px rgba(15, 23, 42, 0.22);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
#solricks-kicker {
|
| 25 |
+
display: inline-flex;
|
| 26 |
+
align-items: center;
|
| 27 |
+
gap: 8px;
|
| 28 |
+
padding: 7px 12px;
|
| 29 |
+
border-radius: 999px;
|
| 30 |
+
background: rgba(255,255,255,0.10);
|
| 31 |
+
color: rgba(255,255,255,0.82);
|
| 32 |
+
font-size: 12px;
|
| 33 |
+
font-weight: 700;
|
| 34 |
+
letter-spacing: 0.08em;
|
| 35 |
+
text-transform: uppercase;
|
| 36 |
+
border: 1px solid rgba(255,255,255,0.14);
|
| 37 |
+
margin-bottom: 16px;
|
| 38 |
}
|
| 39 |
|
| 40 |
#solricks-hero h1 {
|
| 41 |
+
margin: 0 0 10px 0;
|
| 42 |
color: white;
|
| 43 |
+
font-size: 38px;
|
| 44 |
+
line-height: 1.05;
|
| 45 |
+
font-weight: 900;
|
| 46 |
+
letter-spacing: -0.04em;
|
| 47 |
}
|
| 48 |
|
| 49 |
#solricks-hero p {
|
| 50 |
margin: 0;
|
| 51 |
+
max-width: 760px;
|
| 52 |
font-size: 15px;
|
| 53 |
+
line-height: 1.65;
|
| 54 |
+
color: rgba(255,255,255,0.78);
|
| 55 |
}
|
| 56 |
|
| 57 |
+
#solricks-note-row {
|
| 58 |
+
display: flex;
|
| 59 |
+
flex-wrap: wrap;
|
| 60 |
+
gap: 10px;
|
| 61 |
+
margin-top: 18px;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.solricks-pill {
|
| 65 |
+
display: inline-flex;
|
| 66 |
+
align-items: center;
|
| 67 |
+
padding: 8px 12px;
|
| 68 |
border-radius: 999px;
|
| 69 |
+
background: rgba(255,255,255,0.10);
|
| 70 |
+
color: rgba(255,255,255,0.88);
|
| 71 |
font-size: 13px;
|
| 72 |
+
font-weight: 700;
|
| 73 |
+
border: 1px solid rgba(255,255,255,0.14);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
#solricks-panel-note {
|
| 77 |
+
padding: 14px 16px;
|
| 78 |
+
border-radius: 16px;
|
| 79 |
+
background: rgba(79, 70, 229, 0.08);
|
| 80 |
+
border: 1px solid rgba(79, 70, 229, 0.16);
|
| 81 |
+
font-size: 13px;
|
| 82 |
+
line-height: 1.55;
|
| 83 |
+
margin-bottom: 12px;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
#solricks-footer {
|
| 87 |
+
margin-top: 22px;
|
| 88 |
+
padding: 18px 20px;
|
| 89 |
+
border-radius: 18px;
|
| 90 |
+
background: rgba(15, 23, 42, 0.04);
|
| 91 |
+
border: 1px solid rgba(15, 23, 42, 0.08);
|
| 92 |
+
font-size: 13px;
|
| 93 |
+
color: rgba(15, 23, 42, 0.72);
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
#solricks-footer a {
|
| 97 |
+
font-weight: 700;
|
| 98 |
+
text-decoration: none;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
button.primary {
|
| 102 |
+
border-radius: 14px !important;
|
| 103 |
+
font-weight: 800 !important;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
textarea, input, select {
|
| 107 |
+
border-radius: 12px !important;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.svelte-1ipelgc, .wrap {
|
| 111 |
+
border-radius: 16px !important;
|
| 112 |
}
|
| 113 |
"""
|
| 114 |
|
|
|
|
| 179 |
if image_url.startswith("/"):
|
| 180 |
image_url = f"{API_BASE_URL}{image_url}"
|
| 181 |
|
| 182 |
+
return image_url, "Done. Your image was generated successfully."
|
| 183 |
|
| 184 |
except requests.exceptions.Timeout:
|
| 185 |
return None, "Generation timed out. Please try again."
|
|
|
|
| 187 |
return None, f"Error: {error}"
|
| 188 |
|
| 189 |
|
| 190 |
+
theme = gr.themes.Soft(
|
| 191 |
+
primary_hue="indigo",
|
| 192 |
+
secondary_hue="blue",
|
| 193 |
+
neutral_hue="slate",
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
with gr.Blocks(
|
| 197 |
title="SOLRICKS Image Generator",
|
| 198 |
+
theme=theme,
|
| 199 |
css=custom_css,
|
| 200 |
) as demo:
|
| 201 |
gr.Markdown(
|
| 202 |
"""
|
| 203 |
<div id="solricks-hero">
|
| 204 |
+
<div id="solricks-kicker">SOLRICKS 路 VISUAL AI PREVIEW</div>
|
| 205 |
<h1>SOLRICKS Image Generator</h1>
|
| 206 |
+
<p>
|
| 207 |
+
Generate a free preview image using the Solricks visual AI backend.
|
| 208 |
+
This public Space is designed as a lightweight demo for visual AI workflows,
|
| 209 |
+
prompt-based generation, and Solricks-powered image creation.
|
| 210 |
+
</p>
|
| 211 |
+
<div id="solricks-note-row">
|
| 212 |
+
<span class="solricks-pill">Public demo</span>
|
| 213 |
+
<span class="solricks-pill">Rate-limited</span>
|
| 214 |
+
<span class="solricks-pill">Preview generations</span>
|
| 215 |
+
<span class="solricks-pill">Powered by Solricks backend</span>
|
| 216 |
+
</div>
|
| 217 |
</div>
|
| 218 |
"""
|
| 219 |
)
|
| 220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
with gr.Row():
|
| 222 |
+
with gr.Column(scale=5):
|
| 223 |
+
gr.Markdown(
|
| 224 |
+
"""
|
| 225 |
+
<div id="solricks-panel-note">
|
| 226 |
+
<strong>Tip:</strong> Use clear prompts with subject, style, lighting, and scene details.
|
| 227 |
+
For example: <em>cinematic AI robot in a dark premium technology lab, blue accent lighting, realistic details</em>.
|
| 228 |
+
</div>
|
| 229 |
+
"""
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
prompt = gr.Textbox(
|
| 233 |
+
label="Prompt",
|
| 234 |
+
placeholder="Describe the image you want to generate...",
|
| 235 |
+
lines=6,
|
| 236 |
+
max_lines=8,
|
| 237 |
+
)
|
| 238 |
+
|
| 239 |
+
with gr.Row():
|
| 240 |
+
style = gr.Dropdown(
|
| 241 |
+
label="Style",
|
| 242 |
+
choices=ALLOWED_STYLES,
|
| 243 |
+
value="Portrait",
|
| 244 |
+
)
|
| 245 |
+
|
| 246 |
+
resolution = gr.Dropdown(
|
| 247 |
+
label="Resolution",
|
| 248 |
+
choices=ALLOWED_RESOLUTIONS,
|
| 249 |
+
value="1024x1024",
|
| 250 |
+
)
|
| 251 |
+
|
| 252 |
+
generate_button = gr.Button("Generate Image", variant="primary")
|
| 253 |
+
|
| 254 |
+
status = gr.Textbox(
|
| 255 |
+
label="Status",
|
| 256 |
+
interactive=False,
|
| 257 |
+
placeholder="Generation status will appear here...",
|
| 258 |
+
)
|
| 259 |
+
|
| 260 |
+
with gr.Column(scale=6):
|
| 261 |
+
output_image = gr.Image(
|
| 262 |
+
label="Generated Image",
|
| 263 |
+
height=560,
|
| 264 |
+
)
|
| 265 |
|
| 266 |
gr.Examples(
|
| 267 |
examples=[
|
| 268 |
[
|
| 269 |
+
"cinematic close-up portrait of a futuristic android, dark premium lighting, realistic details, sharp focus",
|
| 270 |
"Portrait",
|
| 271 |
"768x1344",
|
| 272 |
],
|
| 273 |
[
|
| 274 |
+
"luxury product photo of a black perfume bottle on a reflective surface, premium studio lighting, elegant background",
|
| 275 |
"Product",
|
| 276 |
"1024x1024",
|
| 277 |
],
|
| 278 |
[
|
| 279 |
+
"modern AI server room with blue accent lights, cinematic technology atmosphere, realistic details",
|
| 280 |
+
"Cinematic",
|
| 281 |
+
"1344x768",
|
| 282 |
+
],
|
| 283 |
+
[
|
| 284 |
+
"realistic AI robot in a dark premium technology lab, cinematic lighting, high detail, blue glow",
|
| 285 |
"Cinematic",
|
| 286 |
"1344x768",
|
| 287 |
],
|
|
|
|
| 289 |
inputs=[prompt, style, resolution],
|
| 290 |
)
|
| 291 |
|
| 292 |
+
gr.Markdown(
|
| 293 |
+
"""
|
| 294 |
+
<div id="solricks-footer">
|
| 295 |
+
<strong>SOLRICKS</strong> develops solution bricks for AI-powered systems, visual AI workflows,
|
| 296 |
+
ComfyUI tools, LoRA resources, and GPU automation.
|
| 297 |
+
<br><br>
|
| 298 |
+
<a href="https://solricks.com/" target="_blank">Website</a>
|
| 299 |
+
路
|
| 300 |
+
<a href="https://github.com/SOLRICKS" target="_blank">GitHub</a>
|
| 301 |
+
路
|
| 302 |
+
<a href="https://civitai.com/user/Solricks" target="_blank">Civitai</a>
|
| 303 |
+
</div>
|
| 304 |
+
"""
|
| 305 |
+
)
|
| 306 |
+
|
| 307 |
generate_button.click(
|
| 308 |
fn=generate_image,
|
| 309 |
inputs=[prompt, style, resolution],
|