Spaces:
Runtime error
Runtime error
Commit
·
ed42d8c
1
Parent(s):
a17f811
Update default scenario and prompts
Browse files
app.py
CHANGED
|
@@ -418,6 +418,16 @@ footer { display: none !important; }
|
|
| 418 |
"""
|
| 419 |
|
| 420 |
# Create interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
with gr.Blocks(
|
| 422 |
title="Cognitive Proxy",
|
| 423 |
theme=gr.themes.Base(
|
|
@@ -472,19 +482,28 @@ with gr.Blocks(
|
|
| 472 |
|
| 473 |
with gr.Row():
|
| 474 |
scenario = gr.Dropdown(
|
| 475 |
-
choices=["
|
| 476 |
-
value="
|
| 477 |
label="Scenario",
|
| 478 |
container=False
|
| 479 |
)
|
| 480 |
|
| 481 |
prompt = gr.Textbox(
|
| 482 |
-
value="
|
| 483 |
label="",
|
| 484 |
placeholder="Enter your prompt...",
|
| 485 |
lines=4
|
| 486 |
)
|
| 487 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
with gr.Row():
|
| 489 |
max_tokens = gr.Slider(20, 150, 80, label="Max tokens", container=False)
|
| 490 |
generate_btn = gr.Button("Generate all variants", variant="primary")
|
|
|
|
| 418 |
"""
|
| 419 |
|
| 420 |
# Create interface
|
| 421 |
+
DEFAULT_PROMPTS = {
|
| 422 |
+
"Technical writing": (
|
| 423 |
+
"Write a concise release note that explains how the Cognitive Proxy uses brain "
|
| 424 |
+
"phase-locking patterns to steer TinyLlama. Include: purpose, what changed, and "
|
| 425 |
+
"one limitation/safety note."
|
| 426 |
+
),
|
| 427 |
+
"Educational": "Explain quantum entanglement in simple terms.",
|
| 428 |
+
"Free form": "Brainstorm creative uses of brain-steered language models in five bullet points."
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
with gr.Blocks(
|
| 432 |
title="Cognitive Proxy",
|
| 433 |
theme=gr.themes.Base(
|
|
|
|
| 482 |
|
| 483 |
with gr.Row():
|
| 484 |
scenario = gr.Dropdown(
|
| 485 |
+
choices=["Technical writing", "Educational", "Free form"],
|
| 486 |
+
value="Technical writing",
|
| 487 |
label="Scenario",
|
| 488 |
container=False
|
| 489 |
)
|
| 490 |
|
| 491 |
prompt = gr.Textbox(
|
| 492 |
+
value=DEFAULT_PROMPTS["Technical writing"],
|
| 493 |
label="",
|
| 494 |
placeholder="Enter your prompt...",
|
| 495 |
lines=4
|
| 496 |
)
|
| 497 |
|
| 498 |
+
def update_prompt(selected):
|
| 499 |
+
return DEFAULT_PROMPTS.get(selected, DEFAULT_PROMPTS["Free form"])
|
| 500 |
+
|
| 501 |
+
scenario.change(
|
| 502 |
+
update_prompt,
|
| 503 |
+
inputs=[scenario],
|
| 504 |
+
outputs=[prompt]
|
| 505 |
+
)
|
| 506 |
+
|
| 507 |
with gr.Row():
|
| 508 |
max_tokens = gr.Slider(20, 150, 80, label="Max tokens", container=False)
|
| 509 |
generate_btn = gr.Button("Generate all variants", variant="primary")
|