Add public prompt ideas and hide settings
Browse files
app.py
CHANGED
|
@@ -190,7 +190,7 @@ footer { display: none !important; }
|
|
| 190 |
_TITLE_BAR = """
|
| 191 |
<div id="title-bar">
|
| 192 |
<span id="app-name">Game Builder AI</span>
|
| 193 |
-
<span id="app-sub">
|
| 194 |
</div>
|
| 195 |
"""
|
| 196 |
|
|
@@ -438,14 +438,6 @@ def tuning_handler(
|
|
| 438 |
return next_history, next_html, next_raw
|
| 439 |
|
| 440 |
|
| 441 |
-
def apply_settings_handler(provider: str, model: str, host: str):
|
| 442 |
-
global orchestrator
|
| 443 |
-
provider = provider.strip().lower()
|
| 444 |
-
model = model.strip()
|
| 445 |
-
host = host.strip()
|
| 446 |
-
orchestrator = GameOrchestrator(model=model, ollama_host=host, provider=provider)
|
| 447 |
-
return f"Applied — provider: `{provider}`, model: `{model}`, host: `{host}`"
|
| 448 |
-
|
| 449 |
|
| 450 |
with gr.Blocks(title="Game Builder AI") as demo:
|
| 451 |
gr.HTML(_TITLE_BAR)
|
|
@@ -478,6 +470,12 @@ with gr.Blocks(title="Game Builder AI") as demo:
|
|
| 478 |
snake_btn = gr.Button("Orb Snake", size="sm")
|
| 479 |
boss_btn = gr.Button("Tiny Boss", size="sm")
|
| 480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
gr.Markdown("### Controls", elem_classes=["panel-heading"])
|
| 482 |
with gr.Row(elem_classes=["control-row"]):
|
| 483 |
new_btn = gr.Button("New", variant="secondary", size="sm")
|
|
@@ -512,13 +510,6 @@ with gr.Blocks(title="Game Builder AI") as demo:
|
|
| 512 |
)
|
| 513 |
game_display = gr.HTML(value=_PLACEHOLDER)
|
| 514 |
|
| 515 |
-
with gr.Tab("Settings"):
|
| 516 |
-
provider_tb = gr.Textbox(label="Model provider", value=MODEL_PROVIDER)
|
| 517 |
-
model_tb = gr.Textbox(label="Model ID", value=MODEL_ID)
|
| 518 |
-
host_tb = gr.Textbox(label="Ollama host", value=OLLAMA_HOST)
|
| 519 |
-
apply_btn = gr.Button("Apply")
|
| 520 |
-
settings_status = gr.Markdown("")
|
| 521 |
-
|
| 522 |
_chat_inputs = [msg_input, chatbot, game_display, raw_html_state]
|
| 523 |
_chat_outputs = [msg_input, chatbot, game_display, raw_html_state]
|
| 524 |
|
|
@@ -574,6 +565,43 @@ with gr.Blocks(title="Game Builder AI") as demo:
|
|
| 574 |
inputs=[chatbot, game_display, raw_html_state],
|
| 575 |
outputs=_chat_outputs,
|
| 576 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 577 |
remix_btn.click(
|
| 578 |
lambda history, display, raw: quick_prompt_handler(
|
| 579 |
"Remix the current game with one surprising new mechanic. "
|
|
@@ -627,12 +655,6 @@ with gr.Blocks(title="Game Builder AI") as demo:
|
|
| 627 |
outputs=[chatbot, game_display, raw_html_state],
|
| 628 |
)
|
| 629 |
|
| 630 |
-
apply_btn.click(
|
| 631 |
-
apply_settings_handler,
|
| 632 |
-
inputs=[provider_tb, model_tb, host_tb],
|
| 633 |
-
outputs=[settings_status],
|
| 634 |
-
)
|
| 635 |
-
|
| 636 |
|
| 637 |
if __name__ == "__main__":
|
| 638 |
demo.launch(css=_CSS)
|
|
|
|
| 190 |
_TITLE_BAR = """
|
| 191 |
<div id="title-bar">
|
| 192 |
<span id="app-name">Game Builder AI</span>
|
| 193 |
+
<span id="app-sub">AI arcade workshop | Build Small Track 2</span>
|
| 194 |
</div>
|
| 195 |
"""
|
| 196 |
|
|
|
|
| 438 |
return next_history, next_html, next_raw
|
| 439 |
|
| 440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
|
| 442 |
with gr.Blocks(title="Game Builder AI") as demo:
|
| 443 |
gr.HTML(_TITLE_BAR)
|
|
|
|
| 470 |
snake_btn = gr.Button("Orb Snake", size="sm")
|
| 471 |
boss_btn = gr.Button("Tiny Boss", size="sm")
|
| 472 |
|
| 473 |
+
|
| 474 |
+
gr.Markdown("### Ideas", elem_classes=["panel-heading"])
|
| 475 |
+
starfish_btn = gr.Button("Sleepy Starfish", size="sm")
|
| 476 |
+
ribbon_btn = gr.Button("Bakery Ribbon", size="sm")
|
| 477 |
+
frog_coin_btn = gr.Button("Frog Coinstorm", size="sm")
|
| 478 |
+
|
| 479 |
gr.Markdown("### Controls", elem_classes=["panel-heading"])
|
| 480 |
with gr.Row(elem_classes=["control-row"]):
|
| 481 |
new_btn = gr.Button("New", variant="secondary", size="sm")
|
|
|
|
| 510 |
)
|
| 511 |
game_display = gr.HTML(value=_PLACEHOLDER)
|
| 512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
_chat_inputs = [msg_input, chatbot, game_display, raw_html_state]
|
| 514 |
_chat_outputs = [msg_input, chatbot, game_display, raw_html_state]
|
| 515 |
|
|
|
|
| 565 |
inputs=[chatbot, game_display, raw_html_state],
|
| 566 |
outputs=_chat_outputs,
|
| 567 |
)
|
| 568 |
+
|
| 569 |
+
starfish_btn.click(
|
| 570 |
+
lambda history, display, raw: quick_prompt_handler(
|
| 571 |
+
"Make a strange arcade game about a sleepy starfish collecting lost "
|
| 572 |
+
"alarm clocks while dodging moon crumbs. It should feel silly, "
|
| 573 |
+
"readable, and playable right away.",
|
| 574 |
+
history,
|
| 575 |
+
display,
|
| 576 |
+
raw,
|
| 577 |
+
),
|
| 578 |
+
inputs=[chatbot, game_display, raw_html_state],
|
| 579 |
+
outputs=_chat_outputs,
|
| 580 |
+
)
|
| 581 |
+
ribbon_btn.click(
|
| 582 |
+
lambda history, display, raw: quick_prompt_handler(
|
| 583 |
+
"Make a snake-style game where I guide a glowing ribbon through a "
|
| 584 |
+
"midnight bakery, eating floating jam orbs and growing longer. The "
|
| 585 |
+
"snake should only move when I press a key.",
|
| 586 |
+
history,
|
| 587 |
+
display,
|
| 588 |
+
raw,
|
| 589 |
+
),
|
| 590 |
+
inputs=[chatbot, game_display, raw_html_state],
|
| 591 |
+
outputs=_chat_outputs,
|
| 592 |
+
)
|
| 593 |
+
frog_coin_btn.click(
|
| 594 |
+
lambda history, display, raw: quick_prompt_handler(
|
| 595 |
+
"Make a weird mix game where a frog platformer gets invaded by "
|
| 596 |
+
"falling coins. I need to jump, collect, and survive until the game "
|
| 597 |
+
"decides I am rich enough.",
|
| 598 |
+
history,
|
| 599 |
+
display,
|
| 600 |
+
raw,
|
| 601 |
+
),
|
| 602 |
+
inputs=[chatbot, game_display, raw_html_state],
|
| 603 |
+
outputs=_chat_outputs,
|
| 604 |
+
)
|
| 605 |
remix_btn.click(
|
| 606 |
lambda history, display, raw: quick_prompt_handler(
|
| 607 |
"Remix the current game with one surprising new mechanic. "
|
|
|
|
| 655 |
outputs=[chatbot, game_display, raw_html_state],
|
| 656 |
)
|
| 657 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 658 |
|
| 659 |
if __name__ == "__main__":
|
| 660 |
demo.launch(css=_CSS)
|