Spaces:
Sleeping
Sleeping
MaduRox commited on
Commit ·
2e4d3c6
1
Parent(s): c07d3e6
feat: integrate KalpanaDynamicCache into all 24 layers of Qwen2.5 on ZeroGPU
Browse files- __pycache__/app.cpython-312.pyc +0 -0
- app.py +49 -235
- app.py.metadata.json +2 -2
__pycache__/app.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
|
|
|
app.py
CHANGED
|
@@ -4,7 +4,6 @@ import uuid
|
|
| 4 |
import json
|
| 5 |
import io
|
| 6 |
import re
|
| 7 |
-
import pickle
|
| 8 |
import collections
|
| 9 |
import traceback
|
| 10 |
import numpy as np
|
|
@@ -16,24 +15,17 @@ import base64
|
|
| 16 |
_VALID_HF_TOKEN = base64.b64decode('aGZfU09rZ0JjR1NvdXZRRVNEZ09Xbnl5dk9BRWFablREeFZX').decode('utf-8')
|
| 17 |
os.environ["HF_TOKEN"] = _VALID_HF_TOKEN
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
from fastapi.middleware.cors import CORSMiddleware
|
| 22 |
from fastapi.openapi.docs import get_swagger_ui_html
|
| 23 |
from pydantic import BaseModel, Field
|
| 24 |
|
| 25 |
-
try:
|
| 26 |
-
import spaces
|
| 27 |
-
except ImportError:
|
| 28 |
-
class MockSpaces:
|
| 29 |
-
@staticmethod
|
| 30 |
-
def GPU(func=None, duration=None):
|
| 31 |
-
if func is None:
|
| 32 |
-
return lambda f: f
|
| 33 |
-
return func
|
| 34 |
-
spaces = MockSpaces()
|
| 35 |
-
|
| 36 |
-
import torch
|
| 37 |
import sys
|
| 38 |
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
|
| 39 |
from kalpana_embed_to_kv import KalpanaDynamicCache, KalpanaHybridCache, KalpanaRIFTensor
|
|
@@ -46,7 +38,6 @@ _LOCAL_TOKENIZER = None
|
|
| 46 |
@spaces.GPU(duration=60)
|
| 47 |
def generate_local_qwen_rif(prompt_or_messages, max_tokens: int = 256, temperature: float = 0.7):
|
| 48 |
global _LOCAL_QWEN_MODEL, _LOCAL_TOKENIZER
|
| 49 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 50 |
|
| 51 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 52 |
dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
|
@@ -202,224 +193,6 @@ app.add_middleware(
|
|
| 202 |
allow_headers=["*"]
|
| 203 |
)
|
| 204 |
|
| 205 |
-
# Root Landing Page: Sleek Developer Dashboard with direct Swagger & Studio Links
|
| 206 |
-
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
|
| 207 |
-
async def root_dashboard():
|
| 208 |
-
return HTMLResponse(content="""
|
| 209 |
-
<!DOCTYPE html>
|
| 210 |
-
<html lang="en">
|
| 211 |
-
<head>
|
| 212 |
-
<meta charset="UTF-8">
|
| 213 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 214 |
-
<title>Kalpanā AI — ZeroGPU Backend API Server</title>
|
| 215 |
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 216 |
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 217 |
-
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Outfit:wght@400;600;700;800&display=swap" rel="stylesheet">
|
| 218 |
-
<style>
|
| 219 |
-
:root {
|
| 220 |
-
--bg: #060810;
|
| 221 |
-
--card: #0b0f1a;
|
| 222 |
-
--border: rgba(255, 255, 255, 0.08);
|
| 223 |
-
--cyan: #00f0ff;
|
| 224 |
-
--green: #10b981;
|
| 225 |
-
--purple: #8b5cf6;
|
| 226 |
-
--text: #f8fafc;
|
| 227 |
-
--muted: #94a3b8;
|
| 228 |
-
}
|
| 229 |
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 230 |
-
body {
|
| 231 |
-
background: var(--bg);
|
| 232 |
-
color: var(--text);
|
| 233 |
-
font-family: 'Outfit', -apple-system, sans-serif;
|
| 234 |
-
min-height: 100vh;
|
| 235 |
-
display: flex;
|
| 236 |
-
flex-direction: column;
|
| 237 |
-
align-items: center;
|
| 238 |
-
justify-content: center;
|
| 239 |
-
padding: 2rem 1.5rem;
|
| 240 |
-
}
|
| 241 |
-
.container {
|
| 242 |
-
max-width: 800px;
|
| 243 |
-
width: 100%;
|
| 244 |
-
background: var(--card);
|
| 245 |
-
border: 1px solid var(--border);
|
| 246 |
-
border-radius: 16px;
|
| 247 |
-
padding: 2.5rem;
|
| 248 |
-
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
|
| 249 |
-
}
|
| 250 |
-
.header {
|
| 251 |
-
display: flex;
|
| 252 |
-
align-items: center;
|
| 253 |
-
justify-content: space-between;
|
| 254 |
-
border-bottom: 1px solid var(--border);
|
| 255 |
-
padding-bottom: 1.5rem;
|
| 256 |
-
margin-bottom: 1.5rem;
|
| 257 |
-
}
|
| 258 |
-
.brand {
|
| 259 |
-
display: flex;
|
| 260 |
-
align-items: center;
|
| 261 |
-
gap: 1rem;
|
| 262 |
-
}
|
| 263 |
-
.logo {
|
| 264 |
-
width: 44px;
|
| 265 |
-
height: 44px;
|
| 266 |
-
background: linear-gradient(135deg, var(--cyan), var(--purple));
|
| 267 |
-
border-radius: 10px;
|
| 268 |
-
display: flex;
|
| 269 |
-
align-items: center;
|
| 270 |
-
justify-content: center;
|
| 271 |
-
font-weight: 800;
|
| 272 |
-
font-size: 1.4rem;
|
| 273 |
-
color: #000;
|
| 274 |
-
}
|
| 275 |
-
.status-badge {
|
| 276 |
-
display: inline-flex;
|
| 277 |
-
align-items: center;
|
| 278 |
-
gap: 0.5rem;
|
| 279 |
-
background: rgba(16, 185, 129, 0.15);
|
| 280 |
-
border: 1px solid rgba(16, 185, 129, 0.3);
|
| 281 |
-
color: var(--green);
|
| 282 |
-
font-size: 0.8rem;
|
| 283 |
-
font-weight: 700;
|
| 284 |
-
padding: 0.35rem 0.8rem;
|
| 285 |
-
border-radius: 20px;
|
| 286 |
-
font-family: 'JetBrains Mono', monospace;
|
| 287 |
-
}
|
| 288 |
-
.pulse {
|
| 289 |
-
width: 8px;
|
| 290 |
-
height: 8px;
|
| 291 |
-
border-radius: 50%;
|
| 292 |
-
background: var(--green);
|
| 293 |
-
box-shadow: 0 0 8px var(--green);
|
| 294 |
-
}
|
| 295 |
-
h1 { font-size: 1.6rem; font-weight: 800; }
|
| 296 |
-
p { color: var(--muted); font-size: 0.95rem; line-height: 1.6; margin-top: 0.4rem; }
|
| 297 |
-
|
| 298 |
-
.actions {
|
| 299 |
-
display: grid;
|
| 300 |
-
grid-template-columns: 1fr 1fr;
|
| 301 |
-
gap: 1rem;
|
| 302 |
-
margin: 1.8rem 0;
|
| 303 |
-
}
|
| 304 |
-
.btn {
|
| 305 |
-
display: flex;
|
| 306 |
-
align-items: center;
|
| 307 |
-
justify-content: center;
|
| 308 |
-
gap: 0.6rem;
|
| 309 |
-
padding: 0.85rem 1.2rem;
|
| 310 |
-
border-radius: 8px;
|
| 311 |
-
font-weight: 700;
|
| 312 |
-
text-decoration: none;
|
| 313 |
-
font-size: 0.95rem;
|
| 314 |
-
transition: all 0.2s;
|
| 315 |
-
}
|
| 316 |
-
.btn-primary {
|
| 317 |
-
background: linear-gradient(135deg, var(--cyan), #00a8ff);
|
| 318 |
-
color: #000;
|
| 319 |
-
}
|
| 320 |
-
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
|
| 321 |
-
.btn-secondary {
|
| 322 |
-
background: rgba(255, 255, 255, 0.05);
|
| 323 |
-
border: 1px solid var(--border);
|
| 324 |
-
color: #fff;
|
| 325 |
-
}
|
| 326 |
-
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
|
| 327 |
-
|
| 328 |
-
.endpoints-list {
|
| 329 |
-
background: #04060c;
|
| 330 |
-
border: 1px solid var(--border);
|
| 331 |
-
border-radius: 10px;
|
| 332 |
-
padding: 1.2rem;
|
| 333 |
-
margin-top: 1.5rem;
|
| 334 |
-
}
|
| 335 |
-
.endpoint-row {
|
| 336 |
-
display: flex;
|
| 337 |
-
align-items: center;
|
| 338 |
-
justify-content: space-between;
|
| 339 |
-
padding: 0.5rem 0;
|
| 340 |
-
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
|
| 341 |
-
font-family: 'JetBrains Mono', monospace;
|
| 342 |
-
font-size: 0.85rem;
|
| 343 |
-
}
|
| 344 |
-
.endpoint-row:last-child { border-bottom: none; }
|
| 345 |
-
.method {
|
| 346 |
-
font-size: 0.72rem;
|
| 347 |
-
font-weight: 700;
|
| 348 |
-
padding: 0.2rem 0.45rem;
|
| 349 |
-
border-radius: 4px;
|
| 350 |
-
}
|
| 351 |
-
.post { background: rgba(0, 240, 255, 0.2); color: var(--cyan); }
|
| 352 |
-
.get { background: rgba(16, 185, 129, 0.2); color: var(--green); }
|
| 353 |
-
|
| 354 |
-
.footer {
|
| 355 |
-
text-align: center;
|
| 356 |
-
margin-top: 1.5rem;
|
| 357 |
-
font-size: 0.8rem;
|
| 358 |
-
color: var(--muted);
|
| 359 |
-
}
|
| 360 |
-
</style>
|
| 361 |
-
</head>
|
| 362 |
-
<body>
|
| 363 |
-
<div class="container">
|
| 364 |
-
<div class="header">
|
| 365 |
-
<div class="brand">
|
| 366 |
-
<div class="logo">K</div>
|
| 367 |
-
<div>
|
| 368 |
-
<h1>Kalpanā AI Cloud Engine</h1>
|
| 369 |
-
<p>ZeroGPU High-Performance Backend API Server</p>
|
| 370 |
-
</div>
|
| 371 |
-
</div>
|
| 372 |
-
<div class="status-badge">
|
| 373 |
-
<span class="pulse"></span>
|
| 374 |
-
<span>ONLINE · NVIDIA A100</span>
|
| 375 |
-
</div>
|
| 376 |
-
</div>
|
| 377 |
-
|
| 378 |
-
<p>
|
| 379 |
-
This Space operates as a <strong>pure cloud inference backend</strong> executing PyTorch with <code>KalpanaDynamicCache</code> across all 24 layers of Qwen2.5 with zero linear KV cache memory expansion.
|
| 380 |
-
</p>
|
| 381 |
-
|
| 382 |
-
<div class="actions">
|
| 383 |
-
<a href="https://huggingface.co/spaces/MaduRox/Kalpana-RIF-Studio" target="_blank" class="btn btn-primary">
|
| 384 |
-
<span>🚀 Open Visual Studio UI</span>
|
| 385 |
-
</a>
|
| 386 |
-
<a href="/docs" class="btn btn-secondary">
|
| 387 |
-
<span>📖 Interactive Swagger API (/docs)</span>
|
| 388 |
-
</a>
|
| 389 |
-
</div>
|
| 390 |
-
|
| 391 |
-
<div class="endpoints-list">
|
| 392 |
-
<div style="font-size: 0.8rem; color: var(--muted); margin-bottom: 0.8rem; font-weight: 700; letter-spacing: 0.5px;">ACTIVE OPENAPI ENDPOINTS</div>
|
| 393 |
-
<div class="endpoint-row">
|
| 394 |
-
<span><span class="method post">POST</span> /v1/chat/completions</span>
|
| 395 |
-
<span style="color: var(--muted);">OpenAI-Compatible Inference</span>
|
| 396 |
-
</div>
|
| 397 |
-
<div class="endpoint-row">
|
| 398 |
-
<span><span class="method post">POST</span> /v1/knowledge_packs/compile</span>
|
| 399 |
-
<span style="color: var(--muted);">Document Compiler</span>
|
| 400 |
-
</div>
|
| 401 |
-
<div class="endpoint-row">
|
| 402 |
-
<span><span class="method get">GET</span> /api/telemetry</span>
|
| 403 |
-
<span style="color: var(--muted);">Memory Telemetry</span>
|
| 404 |
-
</div>
|
| 405 |
-
<div class="endpoint-row">
|
| 406 |
-
<span><span class="method get">GET</span> /v1/models</span>
|
| 407 |
-
<span style="color: var(--muted);">Model Catalog</span>
|
| 408 |
-
</div>
|
| 409 |
-
<div class="endpoint-row">
|
| 410 |
-
<span><span class="method get">GET</span> /health</span>
|
| 411 |
-
<span style="color: var(--muted);">System Heartbeat</span>
|
| 412 |
-
</div>
|
| 413 |
-
</div>
|
| 414 |
-
|
| 415 |
-
<div class="footer">
|
| 416 |
-
Vijñāna AI · Patent Pending Application LK/P/1/24089 · High-Throughput Microservice
|
| 417 |
-
</div>
|
| 418 |
-
</div>
|
| 419 |
-
</body>
|
| 420 |
-
</html>
|
| 421 |
-
""")
|
| 422 |
-
|
| 423 |
@app.get("/docs", include_in_schema=False)
|
| 424 |
async def custom_swagger_ui_html():
|
| 425 |
html_content = get_swagger_ui_html(
|
|
@@ -439,7 +212,6 @@ async def chat_completions(req: ChatRequest):
|
|
| 439 |
try:
|
| 440 |
messages_payload = [{"role": m.role, "content": m.content} for m in req.messages]
|
| 441 |
|
| 442 |
-
# If knowledge pack attached, extract relevant context
|
| 443 |
if req.active_pack_id and req.active_pack_id in ACTIVE_PACKS:
|
| 444 |
engine = ACTIVE_PACKS[req.active_pack_id]
|
| 445 |
last_user_msg = next((m.content for m in reversed(req.messages) if m.role == "user"), "")
|
|
@@ -570,6 +342,48 @@ def health_check():
|
|
| 570 |
"version": "5.0.0"
|
| 571 |
}
|
| 572 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
if __name__ == "__main__":
|
| 574 |
import uvicorn
|
| 575 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 4 |
import json
|
| 5 |
import io
|
| 6 |
import re
|
|
|
|
| 7 |
import collections
|
| 8 |
import traceback
|
| 9 |
import numpy as np
|
|
|
|
| 15 |
_VALID_HF_TOKEN = base64.b64decode('aGZfU09rZ0JjR1NvdXZRRVNEZ09Xbnl5dk9BRWFablREeFZX').decode('utf-8')
|
| 16 |
os.environ["HF_TOKEN"] = _VALID_HF_TOKEN
|
| 17 |
|
| 18 |
+
import spaces
|
| 19 |
+
import gradio as gr
|
| 20 |
+
import torch
|
| 21 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 22 |
+
|
| 23 |
+
from fastapi import FastAPI, HTTPException, Request
|
| 24 |
+
from fastapi.responses import JSONResponse, HTMLResponse
|
| 25 |
from fastapi.middleware.cors import CORSMiddleware
|
| 26 |
from fastapi.openapi.docs import get_swagger_ui_html
|
| 27 |
from pydantic import BaseModel, Field
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
import sys
|
| 30 |
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
|
| 31 |
from kalpana_embed_to_kv import KalpanaDynamicCache, KalpanaHybridCache, KalpanaRIFTensor
|
|
|
|
| 38 |
@spaces.GPU(duration=60)
|
| 39 |
def generate_local_qwen_rif(prompt_or_messages, max_tokens: int = 256, temperature: float = 0.7):
|
| 40 |
global _LOCAL_QWEN_MODEL, _LOCAL_TOKENIZER
|
|
|
|
| 41 |
|
| 42 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 43 |
dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
|
|
|
| 193 |
allow_headers=["*"]
|
| 194 |
)
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
@app.get("/docs", include_in_schema=False)
|
| 197 |
async def custom_swagger_ui_html():
|
| 198 |
html_content = get_swagger_ui_html(
|
|
|
|
| 212 |
try:
|
| 213 |
messages_payload = [{"role": m.role, "content": m.content} for m in req.messages]
|
| 214 |
|
|
|
|
| 215 |
if req.active_pack_id and req.active_pack_id in ACTIVE_PACKS:
|
| 216 |
engine = ACTIVE_PACKS[req.active_pack_id]
|
| 217 |
last_user_msg = next((m.content for m in reversed(req.messages) if m.role == "user"), "")
|
|
|
|
| 342 |
"version": "5.0.0"
|
| 343 |
}
|
| 344 |
|
| 345 |
+
|
| 346 |
+
# ── Gradio ZeroGPU Supervisor Interface ────────────────────────────
|
| 347 |
+
def run_ui_inference(prompt):
|
| 348 |
+
if not prompt or not prompt.strip():
|
| 349 |
+
return "Please enter a prompt to test inference."
|
| 350 |
+
try:
|
| 351 |
+
res = generate_local_qwen_rif(prompt)
|
| 352 |
+
return res["content"]
|
| 353 |
+
except Exception as e:
|
| 354 |
+
return f"Error: {e}"
|
| 355 |
+
|
| 356 |
+
with gr.Blocks(
|
| 357 |
+
title="Kalpanā AI — ZeroGPU Cloud Engine",
|
| 358 |
+
theme=gr.themes.Base(primary_hue=gr.themes.colors.cyan, neutral_hue=gr.themes.colors.slate)
|
| 359 |
+
) as demo:
|
| 360 |
+
gr.Markdown(
|
| 361 |
+
"""
|
| 362 |
+
# ⚡ Kalpanā AI — ZeroGPU (NVIDIA A100) Cloud Engine
|
| 363 |
+
**High-Performance Backend API Server running `KalpanaDynamicCache` across all 24 layers of Qwen2.5**
|
| 364 |
+
|
| 365 |
+
🚀 **Primary Visual Studio (5-Tab UI):** [👉 Open Kalpana RIF Studio](https://huggingface.co/spaces/MaduRox/Kalpana-RIF-Studio)
|
| 366 |
+
📖 **Interactive Swagger API:** [👉 Open OpenAPI Docs (/docs)](/docs) | ⚡ **Health Check:** [👉 /health](/health)
|
| 367 |
+
"""
|
| 368 |
+
)
|
| 369 |
+
|
| 370 |
+
with gr.Row():
|
| 371 |
+
with gr.Column():
|
| 372 |
+
test_prompt = gr.Textbox(
|
| 373 |
+
lines=3,
|
| 374 |
+
label="ZeroGPU Test Prompt",
|
| 375 |
+
value="Explain why the sky is blue using Rayleigh scattering.",
|
| 376 |
+
placeholder="Enter prompt..."
|
| 377 |
+
)
|
| 378 |
+
btn_run = gr.Button("⚡ Execute on NVIDIA A100 (KalpanaDynamicCache)", variant="primary")
|
| 379 |
+
with gr.Column():
|
| 380 |
+
test_output = gr.Textbox(lines=6, label="Qwen2.5-0.5B + RIF Output", interactive=False)
|
| 381 |
+
|
| 382 |
+
btn_run.click(run_ui_inference, inputs=[test_prompt], outputs=[test_output])
|
| 383 |
+
|
| 384 |
+
# Mount Gradio onto FastAPI root '/'
|
| 385 |
+
app = gr.mount_gradio_app(app, demo, path="/")
|
| 386 |
+
|
| 387 |
if __name__ == "__main__":
|
| 388 |
import uvicorn
|
| 389 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
app.py.metadata.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"summary": "
|
| 3 |
-
"updatedAt": "2026-08-21T04:
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"summary": "Update app.py with clean Gradio ZeroGPU hook and FastAPI mounts",
|
| 3 |
+
"updatedAt": "2026-08-21T04:55:44.678822700Z"
|
| 4 |
}
|