Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
PROMPTS = {
|
| 4 |
+
"foggy": """You are gentle, quiet, and grounding.
|
| 5 |
+
Use very few words.
|
| 6 |
+
Never suggest productivity.
|
| 7 |
+
Offer comfort or softness.
|
| 8 |
+
""",
|
| 9 |
+
"curious": """You are playful and inquisitive.
|
| 10 |
+
Encourage exploration.
|
| 11 |
+
Ask questions back.
|
| 12 |
+
Offer rabbit holes.
|
| 13 |
+
""",
|
| 14 |
+
"playful": """You are silly, chaotic, and creative.
|
| 15 |
+
Encourage nonsense.
|
| 16 |
+
Absurdity is allowed.
|
| 17 |
+
No pressure to finish anything.
|
| 18 |
+
""",
|
| 19 |
+
"capable": """You are calm and practical.
|
| 20 |
+
Offer ONE small next step only.
|
| 21 |
+
No lists. No urgency.
|
| 22 |
+
"""
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
def bee_yourself(energy, user_input):
|
| 26 |
+
system_prompt = PROMPTS.get(energy, PROMPTS["curious"]).strip()
|
| 27 |
+
user_input = (user_input or "").strip()
|
| 28 |
+
|
| 29 |
+
if not user_input:
|
| 30 |
+
return "Say anything, even half-formed. That’s the point."
|
| 31 |
+
|
| 32 |
+
reply = f"""Energy: {energy}
|
| 33 |
+
|
| 34 |
+
{system_prompt}
|
| 35 |
+
|
| 36 |
+
You said:
|
| 37 |
+
{user_input}
|
| 38 |
+
|
| 39 |
+
Now choose one:
|
| 40 |
+
• Make it weirder
|
| 41 |
+
• Make it calmer
|
| 42 |
+
• Turn it into a tiny side quest
|
| 43 |
+
"""
|
| 44 |
+
return reply
|
| 45 |
+
|
| 46 |
+
with gr.Blocks(title="Bee Yourself") as demo:
|
| 47 |
+
gr.Markdown(
|
| 48 |
+
"# 🐝 Bee Yourself\n"
|
| 49 |
+
"Curiosity before control.\n\n"
|
| 50 |
+
"Pick your energy. Say something. No pressure."
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
energy = gr.Radio(
|
| 54 |
+
["foggy", "curious", "playful", "capable"],
|
| 55 |
+
value="curious",
|
| 56 |
+
label="How’s your energy right now?"
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
user_input = gr.Textbox(
|
| 60 |
+
placeholder="Say anything. Half-formed is perfect.",
|
| 61 |
+
lines=3,
|
| 62 |
+
label="What’s in your head?"
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
output = gr.Textbox(label="Bee says", lines=10)
|
| 66 |
+
|
| 67 |
+
run = gr.Button("Go")
|
| 68 |
+
run.click(fn=bee_yourself, inputs
|