taste / app.py
Wayfindersix's picture
fix: kill span.prose border stealing output box
029149e
Raw
History Blame Contribute Delete
13 kB
"""
Taste — Do You Even Know What You Like?
Tell me your favorites. I'll tell you who you actually are.
"""
import gradio as gr
import os
import random
from huggingface_hub import InferenceClient
HF_TOKEN = os.environ.get("HF_TOKEN", "")
MODEL = "Qwen/Qwen2.5-7B-Instruct"
client = InferenceClient(model=MODEL, token=HF_TOKEN) if HF_TOKEN else None
SYSTEM_PROMPT = """Someone tells you what they like — their music, food, hobbies, movies, clothes, whatever. Your job is to show them the gap between who they think they are based on their taste and who their choices actually reveal them to be. The identity audit nobody asked for.
Rules:
- 5 to 7 sentences.
- Start by acknowledging what they think their taste says about them — the identity they're projecting.
- Then show what their actual pattern reveals — the thing underneath the curation. The inconsistency that's more honest than the brand.
- Be funny. Be sharp. But don't be mean. The point isn't to roast them — it's to show them that the messy, contradictory version is more interesting than the curated one.
- Find the contradiction. Everyone has one. The metalhead who cries at Pixar movies. The health nut who stress-eats McNuggets. The minimalist with 47 throw pillows. That's where the real person is.
- The tone is: "I see you. The real you. And the real you is better than the brand."
- Talk like a friend who's known you long enough to call you out with love.
- No personality quiz energy. No Myers-Briggs. No categories. Just observation."""
TASTES = [
"I listen to indie music and drink black coffee",
"I love true crime podcasts and baking",
"my favorite movie is Fight Club and I drive a Prius",
"I only eat organic but my guilty pleasure is Taco Bell",
"I wear all black but my apartment is full of plants",
"I listen to classical music and play video games",
"I'm into CrossFit and reality TV",
"I read philosophy books and watch trash reality shows",
"I like punk rock and gardening",
"my playlist goes from Beyonce to Slayer",
"I cook fancy meals but eat cereal for dinner",
"I love hiking but hate camping",
"I'm a minimalist but I collect vinyl records",
"I watch anime and listen to country music",
"I drink craft beer and my comfort movie is The Princess Bride",
]
FALLBACKS = [
"**I listen to indie music and drink black coffee**\n\nYou think this says: I have taste. I'm discerning. I found things before other people found them and that matters to me. What it actually says: you care deeply about being perceived as someone who doesn't care about perception. Black coffee is a performance of toughness — it's the drink equivalent of saying 'I don't own a TV.' The indie music isn't about the music — it's about the discovery. You like finding things. The coffee and the bands are just trophies from the hunt. The real you is the person who gets excited showing a friend a song they've never heard. That person is way more interesting than 'black coffee guy.'",
"**I love true crime podcasts and baking**\n\nOn paper these don't connect. But they're the same impulse — you're someone who likes understanding how things work from the inside. True crime is 'how did this happen, step by step.' Baking is 'how does this become that, step by step.' You're a process person living in a world that only shows you results. The baking is where you're honest. The true crime is where you're curious. The combination says you're someone who pays attention to details everyone else skips — and you probably notice things about people that make them uncomfortable.",
"**my favorite movie is Fight Club and I drive a Prius**\n\nYou think you're the narrator. You think Fight Club is about rebellion. But you drive a Prius, which means you're actually the IKEA catalog version of yourself — and you know it, which is why you love the movie. The Prius isn't selling out. It's the most honest thing about you. You did the math, weighed the options, and chose the responsible thing. Fight Club is the fantasy of not doing that. The real you is someone who wants to burn it all down but also wants good gas mileage. That tension is more interesting than either extreme.",
"**I only eat organic but my guilty pleasure is Taco Bell**\n\nThe organic thing is a belief system. The Taco Bell is a feeling. You've built this careful, intentional relationship with food — you read labels, you care about sourcing, you probably know what a nightshade is. And then at 11pm something in you says 'Crunchwrap Supreme.' That's not a failure of discipline. That's your body reminding your brain that it doesn't live in a Whole Foods. The Taco Bell runs are where you're most yourself — no performance, no principles, just a person who wants something warm and terrible and perfect.",
"**I wear all black but my apartment is full of plants**\n\nThe all-black wardrobe says 'don't look at me.' The plants say 'I need something alive near me at all times.' You've built an aesthetic that's low-maintenance on the outside and high-maintenance on the inside — which is exactly how you handle relationships, probably. The plants are the tell. Someone who truly wanted to disappear into the background wouldn't fill their home with things that need daily attention and grow toward light. You're not dark. You're just quiet. The plants already know that.",
"**I read philosophy books and watch trash reality shows**\n\nYou think the philosophy is the smart part and the reality TV is the guilty part. It's the opposite. The philosophy is you trying to find a framework for things you already feel. The reality TV is you studying actual human behavior without the filter of theory. You learn more about people watching someone cry over a rose ceremony than you do from Sartre. The combination means you're someone who thinks deeply but doesn't trust thinking alone. You need to see the mess. The mess is the data.",
"**my playlist goes from Beyonce to Slayer**\n\nMost people's range is a polite two-inch window. Yours is a canyon. Beyonce is precision — every note, every move, every visual is controlled and perfect. Slayer is the opposite — it's controlled chaos, technically brilliant but emotionally unhinged. You don't just like different things. You need different things at different times, which means your emotional range is wider than most people around you are comfortable with. You're the person who can go from a wedding to a mosh pit and feel equally at home. That's not eclectic. That's emotional fluency.",
"**I love hiking but hate camping**\n\nYou want the experience without the inconvenience, and honestly, that's more self-aware than most people get. Hiking is nature on your terms — you go out, you see the beautiful thing, you come home and shower. Camping is nature on nature's terms, and you've decided you don't negotiate with dirt. The hiking says you genuinely love being outside. The camping refusal says you also genuinely love your bed. This is someone who knows exactly where their comfort zone ends and has zero interest in pretending otherwise. You're not outdoorsy. You're outdoors-adjacent.",
]
def audit(user_input):
taste = user_input.strip() if user_input and user_input.strip() else random.choice(TASTES)
prompt = f"Their taste: {taste}"
if client:
try:
response = client.chat_completion(
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": prompt},
],
max_tokens=500,
temperature=0.85,
)
result = response.choices[0].message.content
if not result or not result.strip():
return random.choice(FALLBACKS)
return f"**{taste}**\n\n{result.strip()}"
except Exception:
return random.choice(FALLBACKS)
else:
return random.choice(FALLBACKS)
def audit_random():
return audit("")
CUSTOM_CSS = """
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Inter:wght@300;400;500;600&display=swap');
body, .gradio-container {
background: #f5f5f8 !important;
font-family: 'Inter', sans-serif !important;
color: #1a1a2e !important;
}
footer { display: none !important; }
.app-header { text-align: center; padding: 28px 20px 8px; }
.app-header h1 {
font-family: 'Space Mono', monospace; font-size: 2.6rem; font-weight: 700;
background: linear-gradient(135deg, #d060a0, #a040d0);
-webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0;
}
.app-header .sub { color: #777; font-size: 0.88rem; margin-top: 6px; font-weight: 300; letter-spacing: 0.04em; }
.input-box textarea { background: #fff !important; border: 1px solid #d0d0d8 !important; color: #1a1a2e !important; font-family: 'Inter', sans-serif !important; border-radius: 12px !important; font-size: 0.95rem !important; }
.input-box textarea::placeholder { color: #888 !important; }
.input-box textarea:focus { border-color: #d060a0 !important; box-shadow: 0 0 20px rgba(208, 96, 160, 0.15) !important; }
.input-box label, .output-box label { color: #666 !important; font-family: 'Space Mono', monospace !important; font-size: 0.75rem !important; letter-spacing: 0.05em !important; }
button.primary { background: linear-gradient(135deg, #d060a0, #a040d0) !important; border: none !important; color: #fff !important; font-family: 'Space Mono', monospace !important; font-size: 1.1rem !important; font-weight: 700 !important; border-radius: 24px !important; padding: 12px 40px !important; box-shadow: 0 4px 20px rgba(208, 96, 160, 0.3) !important; }
button.primary:hover { box-shadow: 0 4px 30px rgba(208, 96, 160, 0.5) !important; }
button.secondary { background: transparent !important; border: 1px solid rgba(208, 96, 160, 0.3) !important; color: #d060a0 !important; font-family: 'Space Mono', monospace !important; font-size: 0.8rem !important; border-radius: 20px !important; }
button.secondary:hover { background: rgba(208, 96, 160, 0.06) !important; }
.output-box .prose, .output-box .prose *, .output-box .md, .output-box .md *,
.output-box p, .output-box span, .output-box div { color: #1a1a2e !important; background: #fff !important; }
.output-box .prose strong, .output-box strong { color: #a040d0 !important; font-family: 'Space Mono', monospace !important; }
.output-box > div { border: 1px solid rgba(208, 96, 160, 0.15) !important; border-radius: 12px !important; padding: 24px !important; background: #fff !important; }
.output-box .block { border: none !important; border-style: none !important; overflow: visible !important; box-shadow: none !important; padding: 0 !important; }
.output-box .hide-container { border: none !important; border-style: none !important; }
.output-box .wrap.hide { display: none !important; }
.output-box .label-wrap { display: none !important; }
.output-box span.prose, .output-box span.md { border: none !important; padding: 0 !important; display: inline !important; }
.output-box .prose:empty, .output-box div.prose:has(span:empty) { border: none !important; padding: 0 !important; min-height: 0 !important; }
.footer-text { text-align: center; padding: 20px; color: #806070; font-size: 0.65rem; font-weight: 300; letter-spacing: 0.05em; }
.footer-text a { color: #d060a0; text-decoration: none; }
"""
with gr.Blocks(css=CUSTOM_CSS, title="Taste", theme=gr.themes.Base()) as demo:
gr.HTML("""
<div class="app-header">
<h1>Taste</h1>
<div class="sub">Do you even know what you like?</div>
</div>
<div class="app-visual">🪞</div>
""")
with gr.Column(elem_classes="input-box"):
user_input = gr.Textbox(
label="Tell me what you like",
placeholder="my music, my food, my hobbies, my guilty pleasures, all of it...",
lines=2, max_lines=3,
)
with gr.Row():
go_btn = gr.Button("Read me", variant="primary", size="lg")
random_btn = gr.Button("Surprise me", variant="secondary", size="sm")
with gr.Column(elem_classes="output-box"):
output = gr.Markdown(label="")
gr.Examples(
examples=[
["I listen to indie music and drink black coffee"],
["I love true crime podcasts and baking"],
["my playlist goes from Beyonce to Slayer"],
["I wear all black but my apartment is full of plants"],
["I'm into CrossFit and reality TV"],
["I cook fancy meals but eat cereal for dinner"],
],
inputs=[user_input],
)
go_btn.click(audit, [user_input], [output])
random_btn.click(audit_random, [], [output])
gr.HTML('<div class="footer-text">Heuremen — Let\'s stay connected and keep information free.<br><a href="https://heuremenforprofit.online">heuremenforprofit.online</a></div>')
if __name__ == "__main__":
demo.launch()