Spaces:
Running on Zero
Running on Zero
Switch to blue and yellow light theme
Browse files
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
title: Image Generator for HTML Games
|
| 3 |
emoji: 🎮
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.14.0
|
| 8 |
app_file: app.py
|
|
|
|
| 1 |
---
|
| 2 |
title: Image Generator for HTML Games
|
| 3 |
emoji: 🎮
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.14.0
|
| 8 |
app_file: app.py
|
app.py
CHANGED
|
@@ -2387,22 +2387,23 @@ def check_hf_token() -> str:
|
|
| 2387 |
|
| 2388 |
APP_CSS = """
|
| 2389 |
:root {
|
| 2390 |
-
--canvas: #
|
| 2391 |
-
--surface: #
|
| 2392 |
-
--surface-raised: #
|
| 2393 |
-
--border: #
|
| 2394 |
-
--border-bright: #
|
| 2395 |
-
--text: #
|
| 2396 |
-
--muted: #
|
| 2397 |
-
--accent: #
|
| 2398 |
-
--accent-strong: #
|
| 2399 |
-
--
|
|
|
|
| 2400 |
}
|
| 2401 |
|
| 2402 |
.gradio-container {
|
| 2403 |
background:
|
| 2404 |
-
radial-gradient(circle at 8% 0%, rgba(
|
| 2405 |
-
radial-gradient(circle at 92%
|
| 2406 |
var(--canvas) !important;
|
| 2407 |
color: var(--text) !important;
|
| 2408 |
max-width: none !important;
|
|
@@ -2416,10 +2417,10 @@ APP_CSS = """
|
|
| 2416 |
overflow: hidden;
|
| 2417 |
padding: 34px 38px;
|
| 2418 |
margin-bottom: 22px;
|
| 2419 |
-
border: 1px solid
|
| 2420 |
border-radius: 24px;
|
| 2421 |
-
background: linear-gradient(135deg,
|
| 2422 |
-
box-shadow: 0 22px 60px rgba(
|
| 2423 |
}
|
| 2424 |
|
| 2425 |
.hero::after {
|
|
@@ -2430,11 +2431,11 @@ APP_CSS = """
|
|
| 2430 |
width: 320px;
|
| 2431 |
height: 320px;
|
| 2432 |
border-radius: 50%;
|
| 2433 |
-
background: radial-gradient(circle, rgba(
|
| 2434 |
}
|
| 2435 |
|
| 2436 |
.eyebrow {
|
| 2437 |
-
color:
|
| 2438 |
font-size: 12px;
|
| 2439 |
font-weight: 800;
|
| 2440 |
letter-spacing: .16em;
|
|
@@ -2450,69 +2451,81 @@ APP_CSS = """
|
|
| 2450 |
letter-spacing: -.045em;
|
| 2451 |
}
|
| 2452 |
|
| 2453 |
-
.hero
|
|
|
|
| 2454 |
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
|
| 2455 |
.hero-chips span {
|
| 2456 |
padding: 7px 11px;
|
| 2457 |
-
border: 1px solid
|
| 2458 |
border-radius: 999px;
|
| 2459 |
-
background: rgba(
|
| 2460 |
-
color: #
|
| 2461 |
font-size: 12px;
|
| 2462 |
font-weight: 700;
|
| 2463 |
}
|
| 2464 |
|
| 2465 |
.step-heading { margin: 28px 0 12px; }
|
| 2466 |
-
.step-heading span { color: var(--
|
| 2467 |
-
.step-heading h2 { margin: 7px 0 3px; color: var(--text); font-size: 24px; letter-spacing: -.025em; }
|
| 2468 |
-
.step-heading p { margin: 0; color: var(--muted); font-size: 14px; }
|
| 2469 |
|
| 2470 |
-
.panel {
|
| 2471 |
border: 1px solid var(--border) !important;
|
| 2472 |
border-radius: 18px !important;
|
| 2473 |
-
background:
|
| 2474 |
-
box-shadow: 0 12px 36px rgba(
|
| 2475 |
padding: 18px !important;
|
| 2476 |
}
|
| 2477 |
|
| 2478 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2479 |
.gradio-container .info { color: var(--muted) !important; }
|
| 2480 |
.gradio-container textarea,
|
| 2481 |
.gradio-container input,
|
| 2482 |
.gradio-container select,
|
| 2483 |
.gradio-container [role="listbox"] {
|
| 2484 |
color: var(--text) !important;
|
| 2485 |
-
background: #
|
| 2486 |
border-color: var(--border) !important;
|
| 2487 |
}
|
| 2488 |
.gradio-container textarea:focus,
|
| 2489 |
-
.gradio-container input:focus { border-color: var(--
|
| 2490 |
|
| 2491 |
#generate-button {
|
| 2492 |
min-height: 52px;
|
| 2493 |
border: 0 !important;
|
| 2494 |
border-radius: 12px !important;
|
| 2495 |
-
background: linear-gradient(135deg,
|
| 2496 |
-
color: #
|
| 2497 |
font-weight: 850 !important;
|
| 2498 |
-
box-shadow: 0 10px 28px rgba(
|
| 2499 |
}
|
| 2500 |
#generate-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
|
| 2501 |
-
.secondary-action { border-color:
|
| 2502 |
-
.status-card { margin-top: 10px; padding: 12px 14px; border-left: 3px solid var(--
|
| 2503 |
-
.status-card p { margin: 0; color: #
|
| 2504 |
.gallery-panel .grid-wrap { background: transparent !important; }
|
| 2505 |
.preview-panel iframe { border: 1px solid var(--border-bright) !important; border-radius: 12px !important; }
|
| 2506 |
.diagnostics { margin-top: 20px; border-color: var(--border) !important; background: var(--surface) !important; }
|
| 2507 |
.pipeline-note { color: var(--muted); font-size: 13px; }
|
| 2508 |
-
.footer-note { margin-top: 28px; color: #
|
| 2509 |
|
| 2510 |
@media (max-width: 780px) {
|
| 2511 |
.app-shell { padding: 14px 14px 42px; }
|
| 2512 |
.hero { padding: 26px 22px; border-radius: 18px; }
|
| 2513 |
.hero h1 { font-size: 38px; }
|
| 2514 |
.hero p { font-size: 15px; }
|
| 2515 |
-
.panel { padding: 13px !important; }
|
| 2516 |
}
|
| 2517 |
"""
|
| 2518 |
|
|
@@ -2539,7 +2552,7 @@ with gr.Blocks(title="Image Generator for HTML Games") as demo:
|
|
| 2539 |
'<p>Paste the game first, then define the assets and shared art direction.</p></div>'
|
| 2540 |
)
|
| 2541 |
with gr.Row(equal_height=False):
|
| 2542 |
-
with gr.Column(scale=3, elem_classes=["panel"]):
|
| 2543 |
html_input = gr.Textbox(
|
| 2544 |
label="Original HTML game code",
|
| 2545 |
lines=22,
|
|
@@ -2547,7 +2560,7 @@ with gr.Blocks(title="Image Generator for HTML Games") as demo:
|
|
| 2547 |
value=STARTER_HTML,
|
| 2548 |
info="Use GAME_ASSETS.<role> or sprite_<role>.png for deterministic embedding.",
|
| 2549 |
)
|
| 2550 |
-
with gr.Column(scale=2, elem_classes=["panel"]):
|
| 2551 |
roles = gr.Textbox(
|
| 2552 |
label="Assets to create",
|
| 2553 |
lines=8,
|
|
@@ -2597,9 +2610,9 @@ with gr.Blocks(title="Image Generator for HTML Games") as demo:
|
|
| 2597 |
'<p>Check subject, perspective, style, and transparency before approving an asset.</p></div>'
|
| 2598 |
)
|
| 2599 |
with gr.Row(equal_height=False):
|
| 2600 |
-
with gr.Column(scale=3, elem_classes=["panel", "gallery-panel"]):
|
| 2601 |
gallery = gr.Gallery(label="Generated assets", columns=2, height=420)
|
| 2602 |
-
with gr.Column(scale=2, elem_classes=["panel"]):
|
| 2603 |
selected_role = gr.Dropdown(
|
| 2604 |
label="Asset to regenerate",
|
| 2605 |
choices=[],
|
|
@@ -2619,9 +2632,9 @@ with gr.Blocks(title="Image Generator for HTML Games") as demo:
|
|
| 2619 |
'<div class="step-heading"><span>Step 03</span><h2>Play and export</h2>'
|
| 2620 |
'<p>Test the integrated game, then copy the rewritten HTML when it looks right.</p></div>'
|
| 2621 |
)
|
| 2622 |
-
with gr.Column(elem_classes=["panel", "preview-panel"]):
|
| 2623 |
preview = gr.HTML("")
|
| 2624 |
-
with gr.Column(elem_classes=["panel"]):
|
| 2625 |
output_code = gr.Code(
|
| 2626 |
label="Rewritten HTML with embedded images",
|
| 2627 |
language="html",
|
|
|
|
| 2387 |
|
| 2388 |
APP_CSS = """
|
| 2389 |
:root {
|
| 2390 |
+
--canvas: #f7f9fe;
|
| 2391 |
+
--surface: #ffffff;
|
| 2392 |
+
--surface-raised: #f1f5ff;
|
| 2393 |
+
--border: #d9e2f2;
|
| 2394 |
+
--border-bright: #b9c9e8;
|
| 2395 |
+
--text: #15233d;
|
| 2396 |
+
--muted: #66758c;
|
| 2397 |
+
--accent: #ffd447;
|
| 2398 |
+
--accent-strong: #efb900;
|
| 2399 |
+
--blue: #2457d6;
|
| 2400 |
+
--blue-deep: #173b8f;
|
| 2401 |
}
|
| 2402 |
|
| 2403 |
.gradio-container {
|
| 2404 |
background:
|
| 2405 |
+
radial-gradient(circle at 8% 0%, rgba(36, 87, 214, .10), transparent 31rem),
|
| 2406 |
+
radial-gradient(circle at 92% 10%, rgba(255, 212, 71, .18), transparent 25rem),
|
| 2407 |
var(--canvas) !important;
|
| 2408 |
color: var(--text) !important;
|
| 2409 |
max-width: none !important;
|
|
|
|
| 2417 |
overflow: hidden;
|
| 2418 |
padding: 34px 38px;
|
| 2419 |
margin-bottom: 22px;
|
| 2420 |
+
border: 1px solid #315ec3;
|
| 2421 |
border-radius: 24px;
|
| 2422 |
+
background: linear-gradient(135deg, #173b8f, #2457d6);
|
| 2423 |
+
box-shadow: 0 22px 60px rgba(32, 74, 172, .18);
|
| 2424 |
}
|
| 2425 |
|
| 2426 |
.hero::after {
|
|
|
|
| 2431 |
width: 320px;
|
| 2432 |
height: 320px;
|
| 2433 |
border-radius: 50%;
|
| 2434 |
+
background: radial-gradient(circle, rgba(255, 221, 100, .30), transparent 66%);
|
| 2435 |
}
|
| 2436 |
|
| 2437 |
.eyebrow {
|
| 2438 |
+
color: #ffe17c !important;
|
| 2439 |
font-size: 12px;
|
| 2440 |
font-weight: 800;
|
| 2441 |
letter-spacing: .16em;
|
|
|
|
| 2451 |
letter-spacing: -.045em;
|
| 2452 |
}
|
| 2453 |
|
| 2454 |
+
.hero h1 { color: #fff !important; }
|
| 2455 |
+
.hero p { max-width: 760px; margin: 0; color: #dce6ff !important; font-size: 17px; line-height: 1.6; }
|
| 2456 |
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
|
| 2457 |
.hero-chips span {
|
| 2458 |
padding: 7px 11px;
|
| 2459 |
+
border: 1px solid rgba(255, 225, 124, .52);
|
| 2460 |
border-radius: 999px;
|
| 2461 |
+
background: rgba(16, 48, 124, .56);
|
| 2462 |
+
color: #fff1b6 !important;
|
| 2463 |
font-size: 12px;
|
| 2464 |
font-weight: 700;
|
| 2465 |
}
|
| 2466 |
|
| 2467 |
.step-heading { margin: 28px 0 12px; }
|
| 2468 |
+
.step-heading span { color: var(--blue) !important; font: 800 12px/1 sans-serif; letter-spacing: .14em; text-transform: uppercase; }
|
| 2469 |
+
.step-heading h2 { margin: 7px 0 3px; color: var(--text) !important; font-size: 24px; letter-spacing: -.025em; }
|
| 2470 |
+
.step-heading p { margin: 0; color: var(--muted) !important; font-size: 14px; }
|
| 2471 |
|
| 2472 |
+
.studio-panel {
|
| 2473 |
border: 1px solid var(--border) !important;
|
| 2474 |
border-radius: 18px !important;
|
| 2475 |
+
background: var(--surface) !important;
|
| 2476 |
+
box-shadow: 0 12px 36px rgba(39, 72, 133, .09);
|
| 2477 |
padding: 18px !important;
|
| 2478 |
}
|
| 2479 |
|
| 2480 |
+
.studio-panel .form,
|
| 2481 |
+
.studio-panel .block {
|
| 2482 |
+
background: transparent !important;
|
| 2483 |
+
}
|
| 2484 |
+
|
| 2485 |
+
.studio-panel .form { border: 0 !important; }
|
| 2486 |
+
.studio-panel .label-wrap,
|
| 2487 |
+
.studio-panel .label-wrap span,
|
| 2488 |
+
.studio-panel label span { color: var(--text) !important; }
|
| 2489 |
+
.studio-panel .info { color: var(--muted) !important; }
|
| 2490 |
+
|
| 2491 |
+
.gradio-container label, .gradio-container .label-wrap { color: var(--text) !important; font-weight: 700 !important; }
|
| 2492 |
.gradio-container .info { color: var(--muted) !important; }
|
| 2493 |
.gradio-container textarea,
|
| 2494 |
.gradio-container input,
|
| 2495 |
.gradio-container select,
|
| 2496 |
.gradio-container [role="listbox"] {
|
| 2497 |
color: var(--text) !important;
|
| 2498 |
+
background: #f8faff !important;
|
| 2499 |
border-color: var(--border) !important;
|
| 2500 |
}
|
| 2501 |
.gradio-container textarea:focus,
|
| 2502 |
+
.gradio-container input:focus { border-color: var(--blue) !important; box-shadow: 0 0 0 3px rgba(36, 87, 214, .12) !important; }
|
| 2503 |
|
| 2504 |
#generate-button {
|
| 2505 |
min-height: 52px;
|
| 2506 |
border: 0 !important;
|
| 2507 |
border-radius: 12px !important;
|
| 2508 |
+
background: linear-gradient(135deg, #ffda58, #ffc928) !important;
|
| 2509 |
+
color: #17315f !important;
|
| 2510 |
font-weight: 850 !important;
|
| 2511 |
+
box-shadow: 0 10px 28px rgba(226, 169, 0, .20);
|
| 2512 |
}
|
| 2513 |
#generate-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
|
| 2514 |
+
.secondary-action { border-color: #b8c9ed !important; background: #eef3ff !important; color: var(--blue-deep) !important; }
|
| 2515 |
+
.status-card { margin-top: 10px; padding: 12px 14px; border-left: 3px solid var(--blue); border-radius: 8px; background: #eef4ff; }
|
| 2516 |
+
.status-card p { margin: 0; color: #385070 !important; }
|
| 2517 |
.gallery-panel .grid-wrap { background: transparent !important; }
|
| 2518 |
.preview-panel iframe { border: 1px solid var(--border-bright) !important; border-radius: 12px !important; }
|
| 2519 |
.diagnostics { margin-top: 20px; border-color: var(--border) !important; background: var(--surface) !important; }
|
| 2520 |
.pipeline-note { color: var(--muted); font-size: 13px; }
|
| 2521 |
+
.footer-note { margin-top: 28px; color: #75849a !important; text-align: center; font-size: 12px; }
|
| 2522 |
|
| 2523 |
@media (max-width: 780px) {
|
| 2524 |
.app-shell { padding: 14px 14px 42px; }
|
| 2525 |
.hero { padding: 26px 22px; border-radius: 18px; }
|
| 2526 |
.hero h1 { font-size: 38px; }
|
| 2527 |
.hero p { font-size: 15px; }
|
| 2528 |
+
.studio-panel { padding: 13px !important; }
|
| 2529 |
}
|
| 2530 |
"""
|
| 2531 |
|
|
|
|
| 2552 |
'<p>Paste the game first, then define the assets and shared art direction.</p></div>'
|
| 2553 |
)
|
| 2554 |
with gr.Row(equal_height=False):
|
| 2555 |
+
with gr.Column(scale=3, elem_classes=["studio-panel"]):
|
| 2556 |
html_input = gr.Textbox(
|
| 2557 |
label="Original HTML game code",
|
| 2558 |
lines=22,
|
|
|
|
| 2560 |
value=STARTER_HTML,
|
| 2561 |
info="Use GAME_ASSETS.<role> or sprite_<role>.png for deterministic embedding.",
|
| 2562 |
)
|
| 2563 |
+
with gr.Column(scale=2, elem_classes=["studio-panel"]):
|
| 2564 |
roles = gr.Textbox(
|
| 2565 |
label="Assets to create",
|
| 2566 |
lines=8,
|
|
|
|
| 2610 |
'<p>Check subject, perspective, style, and transparency before approving an asset.</p></div>'
|
| 2611 |
)
|
| 2612 |
with gr.Row(equal_height=False):
|
| 2613 |
+
with gr.Column(scale=3, elem_classes=["studio-panel", "gallery-panel"]):
|
| 2614 |
gallery = gr.Gallery(label="Generated assets", columns=2, height=420)
|
| 2615 |
+
with gr.Column(scale=2, elem_classes=["studio-panel"]):
|
| 2616 |
selected_role = gr.Dropdown(
|
| 2617 |
label="Asset to regenerate",
|
| 2618 |
choices=[],
|
|
|
|
| 2632 |
'<div class="step-heading"><span>Step 03</span><h2>Play and export</h2>'
|
| 2633 |
'<p>Test the integrated game, then copy the rewritten HTML when it looks right.</p></div>'
|
| 2634 |
)
|
| 2635 |
+
with gr.Column(elem_classes=["studio-panel", "preview-panel"]):
|
| 2636 |
preview = gr.HTML("")
|
| 2637 |
+
with gr.Column(elem_classes=["studio-panel"]):
|
| 2638 |
output_code = gr.Code(
|
| 2639 |
label="Rewritten HTML with embedded images",
|
| 2640 |
language="html",
|