Update app.py
Browse files
app.py
CHANGED
|
@@ -2,123 +2,409 @@ import os
|
|
| 2 |
import requests
|
| 3 |
import gradio as gr
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
.gradio-container {
|
| 7 |
-
max-width:
|
| 8 |
margin: 0 auto !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
}
|
| 10 |
|
| 11 |
#solricks-hero {
|
| 12 |
-
|
| 13 |
-
radial-gradient(circle at 80% 20%, rgba(96, 165, 250, 0.28), transparent 35%),
|
| 14 |
-
radial-gradient(circle at 10% 0%, rgba(124, 58, 237, 0.25), transparent 35%),
|
| 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 |
-
|
| 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:
|
| 34 |
-
letter-spacing: 0.
|
| 35 |
text-transform: uppercase;
|
| 36 |
-
|
| 37 |
-
margin-bottom: 16px;
|
| 38 |
}
|
| 39 |
|
| 40 |
#solricks-hero h1 {
|
| 41 |
-
margin: 0
|
| 42 |
-
color:
|
| 43 |
-
font-size:
|
| 44 |
-
line-height:
|
| 45 |
-
font-weight:
|
| 46 |
-
letter-spacing: -0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
}
|
| 48 |
|
| 49 |
#solricks-hero p {
|
| 50 |
-
margin: 0;
|
| 51 |
max-width: 760px;
|
| 52 |
-
|
|
|
|
| 53 |
line-height: 1.65;
|
| 54 |
-
color: rgba(255,255,255,0.78);
|
| 55 |
}
|
| 56 |
|
| 57 |
-
#solricks-
|
| 58 |
display: flex;
|
| 59 |
flex-wrap: wrap;
|
| 60 |
gap: 10px;
|
| 61 |
margin-top: 18px;
|
| 62 |
}
|
| 63 |
|
| 64 |
-
.solricks-
|
| 65 |
display: inline-flex;
|
| 66 |
align-items: center;
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
font-size: 13px;
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
}
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
border-radius:
|
| 79 |
-
background:
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
font-size: 13px;
|
| 82 |
-
|
| 83 |
-
margin-bottom: 12px;
|
| 84 |
}
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
padding: 18px 20px;
|
| 89 |
-
border-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
border: 1px solid rgba(15, 23, 42, 0.08);
|
|
|
|
| 92 |
font-size: 13px;
|
| 93 |
-
|
|
|
|
| 94 |
}
|
| 95 |
|
| 96 |
-
#solricks-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
}
|
| 100 |
|
| 101 |
-
|
| 102 |
-
border-radius:
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
border-radius: 16px !important;
|
| 112 |
}
|
| 113 |
-
"""
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
|
| 124 |
def generate_image(prompt, style, resolution):
|
|
@@ -198,86 +484,189 @@ with gr.Blocks(
|
|
| 198 |
theme=theme,
|
| 199 |
css=custom_css,
|
| 200 |
) as demo:
|
| 201 |
-
gr.
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
],
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
)
|
| 266 |
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
<div id="solricks-footer">
|
| 270 |
-
<
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
<
|
| 274 |
-
|
| 275 |
-
<
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
</
|
| 279 |
-
|
| 280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
generate_button.click(
|
| 283 |
fn=generate_image,
|
|
@@ -285,4 +674,4 @@ ComfyUI tools, LoRA resources, and GPU automation.
|
|
| 285 |
outputs=[output_image, status],
|
| 286 |
)
|
| 287 |
|
| 288 |
-
demo.queue(max_size=10).launch()
|
|
|
|
| 2 |
import requests
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
+
API_BASE_URL = os.getenv("SOLRICKS_API_BASE_URL", "https://api.solricks.com")
|
| 6 |
+
API_KEY = os.getenv("SOLRICKS_SPACE_API_KEY", "")
|
| 7 |
+
|
| 8 |
+
API_ENDPOINT = f"{API_BASE_URL}/api/workflows/visual-ai/run"
|
| 9 |
+
|
| 10 |
+
ALLOWED_RESOLUTIONS = ["1024x1024", "768x1344", "1344x768"]
|
| 11 |
+
ALLOWED_STYLES = ["Portrait", "Realistic", "Cinematic", "Product"]
|
| 12 |
+
|
| 13 |
custom_css = """
|
| 14 |
+
:root {
|
| 15 |
+
--sr-bg: #f7f9ff;
|
| 16 |
+
--sr-card: rgba(255, 255, 255, 0.92);
|
| 17 |
+
--sr-card-strong: #ffffff;
|
| 18 |
+
--sr-text: #091225;
|
| 19 |
+
--sr-muted: #667085;
|
| 20 |
+
--sr-soft: #eef2ff;
|
| 21 |
+
--sr-border: rgba(90, 85, 255, 0.16);
|
| 22 |
+
--sr-border-strong: rgba(90, 85, 255, 0.24);
|
| 23 |
+
--sr-purple: #6d5dfc;
|
| 24 |
+
--sr-blue: #2557ff;
|
| 25 |
+
--sr-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
|
| 26 |
+
--sr-shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.055);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
.gradio-container {
|
| 30 |
+
max-width: 1520px !important;
|
| 31 |
margin: 0 auto !important;
|
| 32 |
+
background:
|
| 33 |
+
radial-gradient(circle at 10% 8%, rgba(109, 93, 252, 0.14), transparent 30%),
|
| 34 |
+
radial-gradient(circle at 88% 12%, rgba(37, 87, 255, 0.10), transparent 30%),
|
| 35 |
+
linear-gradient(180deg, #fbfcff 0%, var(--sr-bg) 100%) !important;
|
| 36 |
+
color: var(--sr-text) !important;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
#solricks-shell {
|
| 40 |
+
padding: 34px 22px 18px;
|
| 41 |
}
|
| 42 |
|
| 43 |
#solricks-hero {
|
| 44 |
+
margin-bottom: 18px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
}
|
| 46 |
|
| 47 |
#solricks-kicker {
|
| 48 |
+
color: #111a32;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
font-size: 12px;
|
| 50 |
+
font-weight: 900;
|
| 51 |
+
letter-spacing: 0.30em;
|
| 52 |
text-transform: uppercase;
|
| 53 |
+
margin-bottom: 12px;
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
#solricks-hero h1 {
|
| 57 |
+
margin: 0;
|
| 58 |
+
color: #081126;
|
| 59 |
+
font-size: clamp(40px, 5vw, 66px);
|
| 60 |
+
line-height: 0.98;
|
| 61 |
+
font-weight: 950;
|
| 62 |
+
letter-spacing: -0.055em;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
#solricks-hero h1 span {
|
| 66 |
+
background: linear-gradient(90deg, #7c3aed 0%, #4f46e5 45%, #2557ff 100%);
|
| 67 |
+
-webkit-background-clip: text;
|
| 68 |
+
background-clip: text;
|
| 69 |
+
color: transparent;
|
| 70 |
}
|
| 71 |
|
| 72 |
#solricks-hero p {
|
| 73 |
+
margin: 14px 0 0 0;
|
| 74 |
max-width: 760px;
|
| 75 |
+
color: #34405c;
|
| 76 |
+
font-size: 16px;
|
| 77 |
line-height: 1.65;
|
|
|
|
| 78 |
}
|
| 79 |
|
| 80 |
+
#solricks-badges {
|
| 81 |
display: flex;
|
| 82 |
flex-wrap: wrap;
|
| 83 |
gap: 10px;
|
| 84 |
margin-top: 18px;
|
| 85 |
}
|
| 86 |
|
| 87 |
+
.solricks-badge {
|
| 88 |
display: inline-flex;
|
| 89 |
align-items: center;
|
| 90 |
+
gap: 10px;
|
| 91 |
+
min-height: 46px;
|
| 92 |
+
padding: 9px 14px;
|
| 93 |
+
border-radius: 15px;
|
| 94 |
+
border: 1px solid var(--sr-border);
|
| 95 |
+
background: rgba(255, 255, 255, 0.74);
|
| 96 |
+
box-shadow: var(--sr-shadow-soft);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.solricks-badge-icon {
|
| 100 |
+
width: 28px;
|
| 101 |
+
height: 28px;
|
| 102 |
+
display: inline-flex;
|
| 103 |
+
align-items: center;
|
| 104 |
+
justify-content: center;
|
| 105 |
+
border-radius: 10px;
|
| 106 |
+
background: linear-gradient(135deg, rgba(124, 58, 237, 0.16), rgba(37, 87, 255, 0.12));
|
| 107 |
+
color: #5b4bff;
|
| 108 |
+
font-size: 15px;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.solricks-badge strong {
|
| 112 |
+
display: block;
|
| 113 |
font-size: 13px;
|
| 114 |
+
line-height: 1.1;
|
| 115 |
+
color: #111827;
|
| 116 |
+
font-weight: 900;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.solricks-badge small {
|
| 120 |
+
display: block;
|
| 121 |
+
margin-top: 3px;
|
| 122 |
+
font-size: 11px;
|
| 123 |
+
color: #7b8498;
|
| 124 |
+
font-weight: 650;
|
| 125 |
}
|
| 126 |
|
| 127 |
+
.solricks-card {
|
| 128 |
+
border: 1px solid var(--sr-border) !important;
|
| 129 |
+
border-radius: 22px !important;
|
| 130 |
+
background: var(--sr-card) !important;
|
| 131 |
+
box-shadow: var(--sr-shadow) !important;
|
| 132 |
+
overflow: hidden !important;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.solricks-card + .solricks-card {
|
| 136 |
+
margin-top: 14px !important;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.solricks-panel {
|
| 140 |
+
padding: 18px !important;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.solricks-card-title {
|
| 144 |
+
display: flex;
|
| 145 |
+
align-items: center;
|
| 146 |
+
justify-content: space-between;
|
| 147 |
+
gap: 12px;
|
| 148 |
+
margin-bottom: 10px;
|
| 149 |
+
color: #10172a;
|
| 150 |
+
font-size: 15px;
|
| 151 |
+
font-weight: 900;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.solricks-card-title-left {
|
| 155 |
+
display: inline-flex;
|
| 156 |
+
align-items: center;
|
| 157 |
+
gap: 8px;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.solricks-step {
|
| 161 |
+
width: 22px;
|
| 162 |
+
height: 22px;
|
| 163 |
+
display: inline-flex;
|
| 164 |
+
align-items: center;
|
| 165 |
+
justify-content: center;
|
| 166 |
+
border-radius: 999px;
|
| 167 |
+
background: rgba(109, 93, 252, 0.17);
|
| 168 |
+
color: #5b4bff;
|
| 169 |
+
font-size: 12px;
|
| 170 |
+
font-weight: 950;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
.solricks-clear {
|
| 174 |
+
color: #667085;
|
| 175 |
font-size: 13px;
|
| 176 |
+
font-weight: 800;
|
|
|
|
| 177 |
}
|
| 178 |
|
| 179 |
+
.solricks-field-label {
|
| 180 |
+
display: flex;
|
| 181 |
+
align-items: center;
|
| 182 |
+
gap: 8px;
|
| 183 |
+
margin: 2px 0 9px;
|
| 184 |
+
color: #10172a;
|
| 185 |
+
font-size: 14px;
|
| 186 |
+
font-weight: 900;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
textarea,
|
| 190 |
+
input,
|
| 191 |
+
select {
|
| 192 |
+
border-radius: 15px !important;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
textarea {
|
| 196 |
+
min-height: 132px !important;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
.wrap,
|
| 200 |
+
.block,
|
| 201 |
+
.form,
|
| 202 |
+
.input-container,
|
| 203 |
+
.output-class {
|
| 204 |
+
border-radius: 18px !important;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
.solricks-generate-button button,
|
| 208 |
+
button.primary {
|
| 209 |
+
min-height: 54px !important;
|
| 210 |
+
border: 0 !important;
|
| 211 |
+
border-radius: 16px !important;
|
| 212 |
+
color: #ffffff !important;
|
| 213 |
+
background: linear-gradient(90deg, #7c3aed 0%, #5b4bff 46%, #2557ff 100%) !important;
|
| 214 |
+
box-shadow: 0 14px 32px rgba(79, 70, 229, 0.30) !important;
|
| 215 |
+
font-size: 16px !important;
|
| 216 |
+
font-weight: 950 !important;
|
| 217 |
+
letter-spacing: -0.01em;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
.solricks-generate-button button:hover,
|
| 221 |
+
button.primary:hover {
|
| 222 |
+
transform: translateY(-1px);
|
| 223 |
+
filter: brightness(1.03);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
#solricks-status textarea {
|
| 227 |
+
min-height: 54px !important;
|
| 228 |
+
height: 54px !important;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
#solricks-status label {
|
| 232 |
+
display: none !important;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
#solricks-image-panel {
|
| 236 |
+
min-height: 566px !important;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
#solricks-preview-header {
|
| 240 |
padding: 18px 20px;
|
| 241 |
+
border-bottom: 1px solid var(--sr-border);
|
| 242 |
+
display: flex;
|
| 243 |
+
align-items: center;
|
| 244 |
+
justify-content: space-between;
|
| 245 |
+
gap: 12px;
|
| 246 |
+
background: rgba(255, 255, 255, 0.68);
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
#solricks-preview-title {
|
| 250 |
+
display: inline-flex;
|
| 251 |
+
align-items: center;
|
| 252 |
+
gap: 10px;
|
| 253 |
+
color: #10172a;
|
| 254 |
+
font-size: 18px;
|
| 255 |
+
font-weight: 950;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
#solricks-preview-title span {
|
| 259 |
+
width: 30px;
|
| 260 |
+
height: 30px;
|
| 261 |
+
display: inline-flex;
|
| 262 |
+
align-items: center;
|
| 263 |
+
justify-content: center;
|
| 264 |
+
border-radius: 11px;
|
| 265 |
+
background: rgba(109, 93, 252, 0.14);
|
| 266 |
+
color: #5b4bff;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
#solricks-download-ghost {
|
| 270 |
+
padding: 9px 13px;
|
| 271 |
+
border-radius: 12px;
|
| 272 |
border: 1px solid rgba(15, 23, 42, 0.08);
|
| 273 |
+
color: #98a2b3;
|
| 274 |
font-size: 13px;
|
| 275 |
+
font-weight: 850;
|
| 276 |
+
background: rgba(255, 255, 255, 0.70);
|
| 277 |
}
|
| 278 |
|
| 279 |
+
#solricks-output-image,
|
| 280 |
+
#solricks-output-image > div {
|
| 281 |
+
min-height: 500px !important;
|
| 282 |
}
|
| 283 |
|
| 284 |
+
#solricks-output-image img {
|
| 285 |
+
border-radius: 0 0 22px 22px !important;
|
| 286 |
+
object-fit: contain !important;
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
#solricks-output-image .empty,
|
| 290 |
+
#solricks-output-image .icon-wrap {
|
| 291 |
+
color: #7b8498 !important;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
#solricks-examples-wrap {
|
| 295 |
+
margin-top: 18px;
|
| 296 |
}
|
| 297 |
|
| 298 |
+
#solricks-examples-head {
|
| 299 |
+
display: flex;
|
| 300 |
+
justify-content: space-between;
|
| 301 |
+
gap: 14px;
|
| 302 |
+
margin: 0 0 8px;
|
| 303 |
+
color: #10172a;
|
| 304 |
+
font-size: 15px;
|
| 305 |
+
font-weight: 950;
|
| 306 |
}
|
| 307 |
|
| 308 |
+
#solricks-examples-head small {
|
| 309 |
+
color: #8a94a8;
|
| 310 |
+
font-size: 12px;
|
| 311 |
+
font-weight: 750;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
#solricks-examples-wrap table {
|
| 315 |
+
overflow: hidden !important;
|
| 316 |
border-radius: 16px !important;
|
| 317 |
}
|
|
|
|
| 318 |
|
| 319 |
+
#solricks-footer {
|
| 320 |
+
margin-top: 16px;
|
| 321 |
+
padding: 18px 22px;
|
| 322 |
+
border-radius: 20px;
|
| 323 |
+
border: 1px solid var(--sr-border);
|
| 324 |
+
background: rgba(255, 255, 255, 0.84);
|
| 325 |
+
box-shadow: var(--sr-shadow-soft);
|
| 326 |
+
display: flex;
|
| 327 |
+
align-items: center;
|
| 328 |
+
justify-content: space-between;
|
| 329 |
+
gap: 24px;
|
| 330 |
+
flex-wrap: wrap;
|
| 331 |
+
}
|
| 332 |
|
| 333 |
+
#solricks-footer-brand {
|
| 334 |
+
display: inline-flex;
|
| 335 |
+
align-items: center;
|
| 336 |
+
gap: 12px;
|
| 337 |
+
color: #0b1224;
|
| 338 |
+
font-size: 24px;
|
| 339 |
+
font-weight: 950;
|
| 340 |
+
letter-spacing: -0.035em;
|
| 341 |
+
}
|
| 342 |
|
| 343 |
+
#solricks-logo-mark {
|
| 344 |
+
width: 42px;
|
| 345 |
+
height: 42px;
|
| 346 |
+
display: inline-flex;
|
| 347 |
+
align-items: center;
|
| 348 |
+
justify-content: center;
|
| 349 |
+
border-radius: 14px;
|
| 350 |
+
color: #5b4bff;
|
| 351 |
+
background: linear-gradient(135deg, rgba(124, 58, 237, 0.16), rgba(37, 87, 255, 0.12));
|
| 352 |
+
border: 1px solid rgba(109, 93, 252, 0.20);
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
#solricks-footer p {
|
| 356 |
+
margin: 0;
|
| 357 |
+
max-width: 720px;
|
| 358 |
+
color: #3d4660;
|
| 359 |
+
font-size: 14px;
|
| 360 |
+
line-height: 1.55;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
#solricks-links {
|
| 364 |
+
display: flex;
|
| 365 |
+
align-items: center;
|
| 366 |
+
gap: 16px;
|
| 367 |
+
flex-wrap: wrap;
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
#solricks-links a {
|
| 371 |
+
color: #2557d6;
|
| 372 |
+
font-size: 14px;
|
| 373 |
+
font-weight: 850;
|
| 374 |
+
text-decoration: none;
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
#solricks-links a:hover {
|
| 378 |
+
text-decoration: underline;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
footer {
|
| 382 |
+
opacity: 0.78;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
@media (max-width: 900px) {
|
| 386 |
+
#solricks-shell {
|
| 387 |
+
padding: 24px 10px 14px;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
#solricks-hero h1 {
|
| 391 |
+
font-size: 40px;
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
#solricks-image-panel {
|
| 395 |
+
min-height: 430px !important;
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
#solricks-output-image,
|
| 399 |
+
#solricks-output-image > div {
|
| 400 |
+
min-height: 360px !important;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
#solricks-footer {
|
| 404 |
+
align-items: flex-start;
|
| 405 |
+
}
|
| 406 |
+
}
|
| 407 |
+
"""
|
| 408 |
|
| 409 |
|
| 410 |
def generate_image(prompt, style, resolution):
|
|
|
|
| 484 |
theme=theme,
|
| 485 |
css=custom_css,
|
| 486 |
) as demo:
|
| 487 |
+
with gr.Column(elem_id="solricks-shell"):
|
| 488 |
+
gr.HTML(
|
| 489 |
+
"""
|
| 490 |
+
<section id="solricks-hero">
|
| 491 |
+
<div id="solricks-kicker">SOLRICKS · VISUAL AI PREVIEW</div>
|
| 492 |
+
<h1><span>SOLRICKS</span> Image Generator</h1>
|
| 493 |
+
<p>
|
| 494 |
+
Generate a free preview image using the Solricks visual AI backend.
|
| 495 |
+
Create clean visual concepts with simple controls for style and resolution.
|
| 496 |
+
</p>
|
| 497 |
+
|
| 498 |
+
<div id="solricks-badges">
|
| 499 |
+
<div class="solricks-badge">
|
| 500 |
+
<span class="solricks-badge-icon">✦</span>
|
| 501 |
+
<div><strong>Free Preview</strong><small>Preview generations</small></div>
|
| 502 |
+
</div>
|
| 503 |
+
<div class="solricks-badge">
|
| 504 |
+
<span class="solricks-badge-icon">⏱</span>
|
| 505 |
+
<div><strong>Rate Limited</strong><small>Limited daily usage</small></div>
|
| 506 |
+
</div>
|
| 507 |
+
<div class="solricks-badge">
|
| 508 |
+
<span class="solricks-badge-icon">⚙</span>
|
| 509 |
+
<div><strong>Visual AI Backend</strong><small>Powered by Solricks</small></div>
|
| 510 |
+
</div>
|
| 511 |
+
</div>
|
| 512 |
+
</section>
|
| 513 |
+
"""
|
| 514 |
+
)
|
| 515 |
|
| 516 |
+
with gr.Row(equal_height=True):
|
| 517 |
+
with gr.Column(scale=5, min_width=360):
|
| 518 |
+
with gr.Group(elem_classes="solricks-card"):
|
| 519 |
+
with gr.Column(elem_classes="solricks-panel"):
|
| 520 |
+
gr.HTML(
|
| 521 |
+
"""
|
| 522 |
+
<div class="solricks-card-title">
|
| 523 |
+
<div class="solricks-card-title-left">
|
| 524 |
+
<span class="solricks-step">1</span>
|
| 525 |
+
<span>Prompt</span>
|
| 526 |
+
</div>
|
| 527 |
+
<span class="solricks-clear">✦ Clear</span>
|
| 528 |
+
</div>
|
| 529 |
+
"""
|
| 530 |
+
)
|
| 531 |
+
|
| 532 |
+
prompt = gr.Textbox(
|
| 533 |
+
label=None,
|
| 534 |
+
placeholder="Describe the image you want to generate...",
|
| 535 |
+
lines=5,
|
| 536 |
+
max_lines=7,
|
| 537 |
+
max_length=500,
|
| 538 |
+
show_label=False,
|
| 539 |
+
)
|
| 540 |
+
|
| 541 |
+
with gr.Row():
|
| 542 |
+
with gr.Column():
|
| 543 |
+
gr.HTML(
|
| 544 |
+
"""
|
| 545 |
+
<div class="solricks-field-label">
|
| 546 |
+
<span class="solricks-step">2</span>
|
| 547 |
+
<span>Style</span>
|
| 548 |
+
</div>
|
| 549 |
+
"""
|
| 550 |
+
)
|
| 551 |
+
style = gr.Dropdown(
|
| 552 |
+
label=None,
|
| 553 |
+
choices=ALLOWED_STYLES,
|
| 554 |
+
value="Portrait",
|
| 555 |
+
show_label=False,
|
| 556 |
+
)
|
| 557 |
+
|
| 558 |
+
with gr.Column():
|
| 559 |
+
gr.HTML(
|
| 560 |
+
"""
|
| 561 |
+
<div class="solricks-field-label">
|
| 562 |
+
<span class="solricks-step">3</span>
|
| 563 |
+
<span>Resolution</span>
|
| 564 |
+
</div>
|
| 565 |
+
"""
|
| 566 |
+
)
|
| 567 |
+
resolution = gr.Dropdown(
|
| 568 |
+
label=None,
|
| 569 |
+
choices=ALLOWED_RESOLUTIONS,
|
| 570 |
+
value="1024x1024",
|
| 571 |
+
show_label=False,
|
| 572 |
+
)
|
| 573 |
+
|
| 574 |
+
generate_button = gr.Button(
|
| 575 |
+
"✨ Generate Image",
|
| 576 |
+
variant="primary",
|
| 577 |
+
elem_classes="solricks-generate-button",
|
| 578 |
+
)
|
| 579 |
+
|
| 580 |
+
with gr.Group(elem_classes="solricks-card"):
|
| 581 |
+
with gr.Column(elem_classes="solricks-panel"):
|
| 582 |
+
gr.HTML(
|
| 583 |
+
"""
|
| 584 |
+
<div class="solricks-card-title">
|
| 585 |
+
<div class="solricks-card-title-left">
|
| 586 |
+
<span class="solricks-step">4</span>
|
| 587 |
+
<span>Status</span>
|
| 588 |
+
</div>
|
| 589 |
+
</div>
|
| 590 |
+
"""
|
| 591 |
+
)
|
| 592 |
+
|
| 593 |
+
status = gr.Textbox(
|
| 594 |
+
label=None,
|
| 595 |
+
value="Ready to generate. Your generation status will appear here.",
|
| 596 |
+
interactive=False,
|
| 597 |
+
show_label=False,
|
| 598 |
+
elem_id="solricks-status",
|
| 599 |
+
)
|
| 600 |
+
|
| 601 |
+
with gr.Column(scale=6, min_width=420):
|
| 602 |
+
with gr.Group(elem_classes="solricks-card", elem_id="solricks-image-panel"):
|
| 603 |
+
gr.HTML(
|
| 604 |
+
"""
|
| 605 |
+
<div id="solricks-preview-header">
|
| 606 |
+
<div id="solricks-preview-title">
|
| 607 |
+
<span>▧</span>
|
| 608 |
+
Generated Image
|
| 609 |
+
</div>
|
| 610 |
+
<div id="solricks-download-ghost">Download</div>
|
| 611 |
+
</div>
|
| 612 |
+
"""
|
| 613 |
+
)
|
| 614 |
+
|
| 615 |
+
output_image = gr.Image(
|
| 616 |
+
label=None,
|
| 617 |
+
show_label=False,
|
| 618 |
+
height=500,
|
| 619 |
+
elem_id="solricks-output-image",
|
| 620 |
+
)
|
| 621 |
+
|
| 622 |
+
gr.HTML(
|
| 623 |
+
"""
|
| 624 |
+
<div id="solricks-examples-wrap">
|
| 625 |
+
<div id="solricks-examples-head">
|
| 626 |
+
<span>☷ Examples</span>
|
| 627 |
+
<small>Click any example to use the prompt</small>
|
| 628 |
+
</div>
|
| 629 |
+
</div>
|
| 630 |
+
"""
|
| 631 |
+
)
|
| 632 |
+
|
| 633 |
+
gr.Examples(
|
| 634 |
+
examples=[
|
| 635 |
+
[
|
| 636 |
+
"cinematic close-up portrait of a futuristic android, dark premium lighting, realistic details",
|
| 637 |
+
"Portrait",
|
| 638 |
+
"768x1344",
|
| 639 |
+
],
|
| 640 |
+
[
|
| 641 |
+
"realistic AI robot in a dark premium technology lab, cinematic lighting, blue accent lights",
|
| 642 |
+
"Cinematic",
|
| 643 |
+
"1344x768",
|
| 644 |
+
],
|
| 645 |
],
|
| 646 |
+
inputs=[prompt, style, resolution],
|
| 647 |
+
)
|
|
|
|
| 648 |
|
| 649 |
+
gr.HTML(
|
| 650 |
+
"""
|
| 651 |
+
<div id="solricks-footer">
|
| 652 |
+
<div id="solricks-footer-brand">
|
| 653 |
+
<span id="solricks-logo-mark">◇</span>
|
| 654 |
+
SOLRICKS
|
| 655 |
+
</div>
|
| 656 |
+
|
| 657 |
+
<p>
|
| 658 |
+
SOLRICKS develops solution bricks for AI-powered systems, visual AI workflows,
|
| 659 |
+
ComfyUI tools, LoRA resources, and GPU automation.
|
| 660 |
+
</p>
|
| 661 |
+
|
| 662 |
+
<div id="solricks-links">
|
| 663 |
+
<a href="https://solricks.com/" target="_blank">Website ↗</a>
|
| 664 |
+
<a href="https://github.com/SOLRICKS" target="_blank">GitHub ↗</a>
|
| 665 |
+
<a href="https://civitai.com/user/Solricks" target="_blank">Civitai ↗</a>
|
| 666 |
+
</div>
|
| 667 |
+
</div>
|
| 668 |
+
"""
|
| 669 |
+
)
|
| 670 |
|
| 671 |
generate_button.click(
|
| 672 |
fn=generate_image,
|
|
|
|
| 674 |
outputs=[output_image, status],
|
| 675 |
)
|
| 676 |
|
| 677 |
+
demo.queue(max_size=10).launch()
|