Full dark CSS: gradient hero, stats bar, styled chat bubbles, purple accents, clickable example buttons
Browse files
app.py
CHANGED
|
@@ -76,7 +76,258 @@ def respond(message: str):
|
|
| 76 |
res = f"β
**{tool}** result:\n\n```\n{result}\n```"
|
| 77 |
return [[call, res]]
|
| 78 |
|
| 79 |
-
# βββ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
EXAMPLES = [
|
| 82 |
"Calculate compound interest on $1500 at 7% over 30 years",
|
|
@@ -89,19 +340,37 @@ EXAMPLES = [
|
|
| 89 |
def build():
|
| 90 |
with gr.Blocks(title="Stack X Ultimate") as demo:
|
| 91 |
gr.Markdown(
|
| 92 |
-
"## π€ Stack X Ultimate\n\n"
|
| 93 |
"**Open-source agentic model with tool calling.** Deploy on your own GPU β no API key, no data leaving your server.\n\n"
|
| 94 |
-
"π’ `calculator` Β· π `get_current_time` Β· π `search_files` Β· β‘ `run_command`
|
| 95 |
-
"
|
| 96 |
)
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
|
|
|
| 100 |
with gr.Row():
|
| 101 |
txt = gr.Textbox(placeholder="Type a message or try an example below...", lines=1, scale=5)
|
| 102 |
-
btn = gr.Button("Send β",
|
|
|
|
| 103 |
|
| 104 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
btn.click(respond, [txt], [chatbot])
|
| 107 |
txt.submit(respond, [txt], [chatbot])
|
|
@@ -110,11 +379,16 @@ def build():
|
|
| 110 |
gr.Markdown(
|
| 111 |
"π§ Demo shows tool-calling capability. "
|
| 112 |
"[Deploy the model](https://huggingface.co/my-ai-stack/Stack-X-Ultimate) Β· "
|
| 113 |
-
"[Enterprise inquiry](https://www.stack-ai.me/contact)"
|
|
|
|
| 114 |
)
|
| 115 |
|
| 116 |
return demo
|
| 117 |
|
| 118 |
if __name__ == "__main__":
|
| 119 |
demo = build()
|
| 120 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
res = f"β
**{tool}** result:\n\n```\n{result}\n```"
|
| 77 |
return [[call, res]]
|
| 78 |
|
| 79 |
+
# βββ Dark CSS βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 80 |
+
|
| 81 |
+
DARK_CSS = """
|
| 82 |
+
:root {
|
| 83 |
+
--bg-primary: #080808;
|
| 84 |
+
--bg-secondary: #0f0f0f;
|
| 85 |
+
--bg-card: #111111;
|
| 86 |
+
--border: #1c1c1c;
|
| 87 |
+
--border-accent: #2e1a4a;
|
| 88 |
+
--text-primary: #ededed;
|
| 89 |
+
--text-secondary: #8a8a8a;
|
| 90 |
+
--text-muted: #4a4a4a;
|
| 91 |
+
--accent: #a855f7;
|
| 92 |
+
--accent-bright: #c084fc;
|
| 93 |
+
--accent-dim: rgba(168, 85, 247, 0.15);
|
| 94 |
+
--accent-glow: rgba(168, 85, 247, 0.35);
|
| 95 |
+
--green: #4ade80;
|
| 96 |
+
--cyan: #22d3ee;
|
| 97 |
+
--yellow: #facc15;
|
| 98 |
+
--radius: 12px;
|
| 99 |
+
--radius-sm: 8px;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/* ββ Reset ββ */
|
| 103 |
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 104 |
+
body, html {
|
| 105 |
+
background: var(--bg-primary) !important;
|
| 106 |
+
color: var(--text-primary) !important;
|
| 107 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/* ββ Gradio container ββ */
|
| 111 |
+
.gradio-container {
|
| 112 |
+
background: var(--bg-primary) !important;
|
| 113 |
+
max-width: 860px !important;
|
| 114 |
+
margin: 0 auto !important;
|
| 115 |
+
border-left: 1px solid var(--border) !important;
|
| 116 |
+
border-right: 1px solid var(--border) !important;
|
| 117 |
+
min-height: 100vh !important;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/* ββ Markdown / header ββ */
|
| 121 |
+
.md-block {
|
| 122 |
+
background: var(--bg-secondary) !important;
|
| 123 |
+
border: 1px solid var(--border) !important;
|
| 124 |
+
border-radius: var(--radius) !important;
|
| 125 |
+
padding: 20px 24px !important;
|
| 126 |
+
margin: 16px !important;
|
| 127 |
+
text-align: center !important;
|
| 128 |
+
}
|
| 129 |
+
.md-block h2 {
|
| 130 |
+
font-size: 1.6rem !important;
|
| 131 |
+
font-weight: 800 !important;
|
| 132 |
+
color: #fff !important;
|
| 133 |
+
margin-bottom: 6px !important;
|
| 134 |
+
}
|
| 135 |
+
.md-block h2 span {
|
| 136 |
+
background: linear-gradient(135deg, var(--accent), #818cf8) !important;
|
| 137 |
+
-webkit-background-clip: text !important;
|
| 138 |
+
-webkit-text-fill-color: transparent !important;
|
| 139 |
+
background-clip: text !important;
|
| 140 |
+
}
|
| 141 |
+
.md-block p {
|
| 142 |
+
color: var(--text-secondary) !important;
|
| 143 |
+
font-size: 0.9rem !important;
|
| 144 |
+
margin: 4px 0 !important;
|
| 145 |
+
}
|
| 146 |
+
.md-block code {
|
| 147 |
+
background: var(--accent-dim) !important;
|
| 148 |
+
color: var(--accent-bright) !important;
|
| 149 |
+
border-radius: 4px !important;
|
| 150 |
+
padding: 1px 6px !important;
|
| 151 |
+
font-size: 0.82rem !important;
|
| 152 |
+
}
|
| 153 |
+
.md-block strong { color: var(--text-primary) !important; }
|
| 154 |
+
|
| 155 |
+
/* ββ Stats row ββ */
|
| 156 |
+
.stats {
|
| 157 |
+
display: flex !important;
|
| 158 |
+
justify-content: center !important;
|
| 159 |
+
gap: 0 !important;
|
| 160 |
+
margin: 0 16px 12px !important;
|
| 161 |
+
background: var(--bg-card) !important;
|
| 162 |
+
border: 1px solid var(--border) !important;
|
| 163 |
+
border-radius: var(--radius) !important;
|
| 164 |
+
overflow: hidden !important;
|
| 165 |
+
}
|
| 166 |
+
.stat {
|
| 167 |
+
flex: 1 !important;
|
| 168 |
+
text-align: center !important;
|
| 169 |
+
padding: 12px 8px !important;
|
| 170 |
+
border-right: 1px solid var(--border) !important;
|
| 171 |
+
}
|
| 172 |
+
.stat:last-child { border-right: none !important; }
|
| 173 |
+
.stat-val {
|
| 174 |
+
font-size: 1.2rem !important;
|
| 175 |
+
font-weight: 800 !important;
|
| 176 |
+
color: var(--accent-bright) !important;
|
| 177 |
+
display: block !important;
|
| 178 |
+
}
|
| 179 |
+
.stat-lbl {
|
| 180 |
+
font-size: 0.6rem !important;
|
| 181 |
+
color: var(--text-muted) !important;
|
| 182 |
+
text-transform: uppercase !important;
|
| 183 |
+
letter-spacing: 0.08em !important;
|
| 184 |
+
display: block !important;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
/* ββ Chatbot ββ */
|
| 188 |
+
.chat-container {
|
| 189 |
+
background: var(--bg-primary) !important;
|
| 190 |
+
margin: 0 16px !important;
|
| 191 |
+
}
|
| 192 |
+
.chat-message {
|
| 193 |
+
border-radius: var(--radius) !important;
|
| 194 |
+
padding: 10px 14px !important;
|
| 195 |
+
font-size: 0.92rem !important;
|
| 196 |
+
line-height: 1.5 !important;
|
| 197 |
+
border: 1px solid var(--border) !important;
|
| 198 |
+
margin-bottom: 8px !important;
|
| 199 |
+
}
|
| 200 |
+
.chat-message.user {
|
| 201 |
+
background: #161616 !important;
|
| 202 |
+
border-color: #262626 !important;
|
| 203 |
+
color: #e8e8e8 !important;
|
| 204 |
+
}
|
| 205 |
+
.chat-message.bot {
|
| 206 |
+
background: var(--bg-secondary) !important;
|
| 207 |
+
color: #d4d4d4 !important;
|
| 208 |
+
}
|
| 209 |
+
.chat-message pre {
|
| 210 |
+
background: #080808 !important;
|
| 211 |
+
border: 1px solid #1e1e1e !important;
|
| 212 |
+
border-radius: var(--radius-sm) !important;
|
| 213 |
+
padding: 10px 12px !important;
|
| 214 |
+
font-size: 0.82rem !important;
|
| 215 |
+
overflow-x: auto !important;
|
| 216 |
+
margin: 6px 0 !important;
|
| 217 |
+
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace !important;
|
| 218 |
+
}
|
| 219 |
+
.chat-message code {
|
| 220 |
+
background: #080808 !important;
|
| 221 |
+
border: 1px solid #1e1e1e !important;
|
| 222 |
+
border-radius: 4px !important;
|
| 223 |
+
padding: 1px 5px !important;
|
| 224 |
+
font-size: 0.82rem !important;
|
| 225 |
+
font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
|
| 226 |
+
}
|
| 227 |
+
.chat-message .tool-call {
|
| 228 |
+
color: var(--cyan) !important;
|
| 229 |
+
font-family: monospace !important;
|
| 230 |
+
}
|
| 231 |
+
.chat-message .tool-result {
|
| 232 |
+
color: var(--green) !important;
|
| 233 |
+
font-family: monospace !important;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
/* ββ Input row ββ */
|
| 237 |
+
.input-row {
|
| 238 |
+
display: flex !important;
|
| 239 |
+
gap: 10px !important;
|
| 240 |
+
padding: 12px 16px !important;
|
| 241 |
+
background: var(--bg-secondary) !important;
|
| 242 |
+
border-top: 1px solid var(--border) !important;
|
| 243 |
+
margin-top: 8px !important;
|
| 244 |
+
}
|
| 245 |
+
input[type=text], textarea {
|
| 246 |
+
background: #0c0c0c !important;
|
| 247 |
+
border: 1px solid #222222 !important;
|
| 248 |
+
border-radius: var(--radius) !important;
|
| 249 |
+
color: #f0f0f0 !important;
|
| 250 |
+
font-size: 0.95rem !important;
|
| 251 |
+
padding: 10px 14px !important;
|
| 252 |
+
flex: 1 !important;
|
| 253 |
+
outline: none !important;
|
| 254 |
+
transition: border-color 0.2s !important;
|
| 255 |
+
}
|
| 256 |
+
input[type=text]:focus, textarea:focus {
|
| 257 |
+
border-color: var(--accent) !important;
|
| 258 |
+
box-shadow: 0 0 0 3px var(--accent-glow) !important;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
/* ββ Send button ββ */
|
| 262 |
+
.send-btn {
|
| 263 |
+
background: var(--accent) !important;
|
| 264 |
+
border: none !important;
|
| 265 |
+
border-radius: var(--radius) !important;
|
| 266 |
+
color: #fff !important;
|
| 267 |
+
font-weight: 700 !important;
|
| 268 |
+
font-size: 0.9rem !important;
|
| 269 |
+
padding: 10px 20px !important;
|
| 270 |
+
cursor: pointer !important;
|
| 271 |
+
transition: background 0.15s ease, transform 0.1s ease !important;
|
| 272 |
+
white-space: nowrap !important;
|
| 273 |
+
}
|
| 274 |
+
.send-btn:hover {
|
| 275 |
+
background: var(--accent-bright) !important;
|
| 276 |
+
transform: translateY(-1px) !important;
|
| 277 |
+
}
|
| 278 |
+
.send-btn:active {
|
| 279 |
+
transform: translateY(0) !important;
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/* ββ Examples ββ */
|
| 283 |
+
.examples {
|
| 284 |
+
margin: 12px 16px !important;
|
| 285 |
+
}
|
| 286 |
+
.examples-label {
|
| 287 |
+
color: var(--text-muted) !important;
|
| 288 |
+
font-size: 0.75rem !important;
|
| 289 |
+
text-transform: uppercase !important;
|
| 290 |
+
letter-spacing: 0.06em !important;
|
| 291 |
+
margin-bottom: 8px !important;
|
| 292 |
+
display: block !important;
|
| 293 |
+
}
|
| 294 |
+
.example-btn {
|
| 295 |
+
display: inline-flex !important;
|
| 296 |
+
align-items: center !important;
|
| 297 |
+
background: #0e0e0e !important;
|
| 298 |
+
border: 1px solid #1e1e1e !important;
|
| 299 |
+
border-radius: 999px !important;
|
| 300 |
+
color: #888888 !important;
|
| 301 |
+
font-size: 0.8rem !important;
|
| 302 |
+
padding: 5px 12px !important;
|
| 303 |
+
margin: 0 4px 6px 0 !important;
|
| 304 |
+
cursor: pointer !important;
|
| 305 |
+
transition: all 0.15s ease !important;
|
| 306 |
+
text-decoration: none !important;
|
| 307 |
+
}
|
| 308 |
+
.example-btn:hover {
|
| 309 |
+
background: #181818 !important;
|
| 310 |
+
border-color: var(--accent) !important;
|
| 311 |
+
color: var(--accent-bright) !important;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
/* ββ Footer ββ */
|
| 315 |
+
.footer {
|
| 316 |
+
text-align: center !important;
|
| 317 |
+
color: #3a3a3a !important;
|
| 318 |
+
font-size: 0.72rem !important;
|
| 319 |
+
padding: 14px 16px !important;
|
| 320 |
+
border-top: 1px solid var(--border) !important;
|
| 321 |
+
margin-top: 16px !important;
|
| 322 |
+
}
|
| 323 |
+
.footer a {
|
| 324 |
+
color: var(--accent) !important;
|
| 325 |
+
text-decoration: none !important;
|
| 326 |
+
}
|
| 327 |
+
.footer a:hover { text-decoration: underline !important; }
|
| 328 |
+
"""
|
| 329 |
+
|
| 330 |
+
# βββ Build UI ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 331 |
|
| 332 |
EXAMPLES = [
|
| 333 |
"Calculate compound interest on $1500 at 7% over 30 years",
|
|
|
|
| 340 |
def build():
|
| 341 |
with gr.Blocks(title="Stack X Ultimate") as demo:
|
| 342 |
gr.Markdown(
|
| 343 |
+
"## π€ Stack X <span>Ultimate</span>\n\n"
|
| 344 |
"**Open-source agentic model with tool calling.** Deploy on your own GPU β no API key, no data leaving your server.\n\n"
|
| 345 |
+
"π’ `calculator` Β· π `get_current_time` Β· π `search_files` Β· β‘ `run_command`",
|
| 346 |
+
elem_classes="md-block"
|
| 347 |
)
|
| 348 |
|
| 349 |
+
gr.HTML("""
|
| 350 |
+
<div class="stats">
|
| 351 |
+
<div class="stat"><span class="stat-val">3B</span><span class="stat-lbl">Params</span></div>
|
| 352 |
+
<div class="stat"><span class="stat-val">Q4</span><span class="stat-lbl">GGUF</span></div>
|
| 353 |
+
<div class="stat"><span class="stat-val">V100</span><span class="stat-lbl">1 GPU</span></div>
|
| 354 |
+
<div class="stat"><span class="stat-val">$0</span><span class="stat-lbl">API Cost</span></div>
|
| 355 |
+
<div class="stat"><span class="stat-val">8K</span><span class="stat-lbl">Context</span></div>
|
| 356 |
+
</div>
|
| 357 |
+
""")
|
| 358 |
+
|
| 359 |
+
chatbot = gr.Chatbot(height=420)
|
| 360 |
|
| 361 |
+
gr.HTML('<div class="input-row">')
|
| 362 |
with gr.Row():
|
| 363 |
txt = gr.Textbox(placeholder="Type a message or try an example below...", lines=1, scale=5)
|
| 364 |
+
btn = gr.Button("Send β", elem_classes="send-btn")
|
| 365 |
+
gr.HTML('</div>')
|
| 366 |
|
| 367 |
+
gr.HTML('<div class="examples">')
|
| 368 |
+
gr.HTML('<span class="examples-label">Try one of these β</span>')
|
| 369 |
+
for ex in EXAMPLES:
|
| 370 |
+
gr.HTML(
|
| 371 |
+
f'<button class="example-btn" onclick="document.querySelector(\'textarea\').value=\'{ex.replace(chr(39), "'")}\'; document.querySelector(\'textarea\').dispatchEvent(new Event(\'input\'))">{ex}</button>'
|
| 372 |
+
)
|
| 373 |
+
gr.HTML('</div>')
|
| 374 |
|
| 375 |
btn.click(respond, [txt], [chatbot])
|
| 376 |
txt.submit(respond, [txt], [chatbot])
|
|
|
|
| 379 |
gr.Markdown(
|
| 380 |
"π§ Demo shows tool-calling capability. "
|
| 381 |
"[Deploy the model](https://huggingface.co/my-ai-stack/Stack-X-Ultimate) Β· "
|
| 382 |
+
"[Enterprise inquiry](https://www.stack-ai.me/contact)",
|
| 383 |
+
elem_classes="footer"
|
| 384 |
)
|
| 385 |
|
| 386 |
return demo
|
| 387 |
|
| 388 |
if __name__ == "__main__":
|
| 389 |
demo = build()
|
| 390 |
+
demo.launch(
|
| 391 |
+
server_name="0.0.0.0",
|
| 392 |
+
server_port=7860,
|
| 393 |
+
css=DARK_CSS,
|
| 394 |
+
)
|