manopoly / app.py
Wayfindersix's picture
ship: remove emoji, add fallback matching
d2bebe7
Raw
History Blame Contribute Delete
13.4 kB
"""
Manopoly — Pick a Company. See How Deep It Goes.
You think you chose them. They chose your whole day.
"""
import gradio as gr
import os
import random
from huggingface_hub import InferenceClient
HF_TOKEN = os.environ.get("HF_TOKEN", "")
MODEL = "mistralai/Mistral-7B-Instruct-v0.3"
client = InferenceClient(model=MODEL, token=HF_TOKEN) if HF_TOKEN else None
SYSTEM_PROMPT = """Someone names a company. Your job is to show them how deep that company's influence goes into their daily life — products, subsidiaries, supply chains, data, infrastructure, lobbying, standards they set. Not conspiracy. Just facts. The map of how one company touches a day you thought was yours.
Rules:
- 5 to 7 sentences.
- Name specific subsidiaries, brands, products, or services most people don't know are connected to this company.
- Show one way they influence something that seems completely unrelated to their main product.
- Include one thing about their supply chain, lobbying, or standard-setting that affects the user whether they're a customer or not.
- Don't moralize. Don't say boycott. Don't say "scary." Just show the map.
- The tone is: "you thought you were choosing. Here's what was already chosen for you."
- Be specific. Name names, products, dollar amounts when possible.
- Talk like a friend who reads annual reports for fun."""
COMPANIES = [
"Google",
"Amazon",
"Nestle",
"Apple",
"Disney",
"Procter & Gamble",
"Unilever",
"Meta",
"Walmart",
"Johnson & Johnson",
"Coca-Cola",
"Microsoft",
"Samsung",
"Berkshire Hathaway",
"BlackRock",
"Tyson Foods",
"Luxottica",
"Koch Industries",
"3M",
"Monsanto/Bayer",
]
FALLBACKS = [
"**Luxottica**\n\nYou probably don't know this company by name, but they made your glasses. Ray-Ban, Oakley, Persol, Oliver Peoples, Prada eyewear, Chanel eyewear, Versace eyewear — all Luxottica. They also own LensCrafters, Pearle Vision, Sunglass Hut, Target Optical, and they run the EyeMed insurance plan that covers your lenses. One company makes the glasses, sells you the glasses, and insures the glasses. They merged with the biggest lens manufacturer (Essilor) in 2018 to form EssilorLuxottica. That's why a pair of frames that costs $4 to make retails for $300. You thought expensive glasses were about quality. It's about owning every step between your face and your wallet.",
"**Google**\n\nGoogle sees your searches, your emails (Gmail), your location (Maps/Android), your files (Drive), your calendar, your photos, your browsing history (Chrome), what you watch (YouTube), and what you buy (Google Pay). But that's the obvious stuff. They also run the ad infrastructure on most websites you visit — even ones that aren't Google. They own Waze, Fitbit, Nest, and the analytics backend for most apps on your phone. The DNS service many internet providers use (8.8.8.8) is Google. They don't just know what you search for. They know what everyone searches for, and that data shapes what the internet shows you before you even type.",
"**Amazon**\n\nAmazon is a store the way an iceberg is an ice cube. The shopping part is the visible tip. Underneath: AWS (Amazon Web Services) runs about a third of the internet — Netflix, Airbnb, the CIA, and most startups all run on Amazon's servers. Whole Foods is Amazon. Ring doorbells are Amazon. Twitch is Amazon. IMDb is Amazon. Audible is Amazon. They own a healthcare company, a satellite internet project (Kuiper), and a logistics network bigger than FedEx. They don't just sell you things. They sell other companies the infrastructure to sell you things. And when those companies succeed, Amazon studies what they sold and makes an Amazon Basics version of it.",
"**Nestle**\n\nNestle owns over 2,000 brands across 186 countries. They make Kit Kat, Cheerios (outside the US), Perrier, San Pellegrino, Poland Spring, Purina pet food, Gerber baby food, Nescafe, DiGiorno pizza, Stouffer's, Hot Pockets, and Haagen-Dazs (outside the US). They're the world's largest food company. But the reach goes deeper: they control water rights in communities across the US, Canada, and developing nations — pumping millions of gallons from public water sources and selling it back in bottles. Whether you buy their products or not, they influence what water costs, what baby formula standards look like, and what gets shelf space at your grocery store.",
"**Procter & Gamble**\n\nP&G makes Tide, Pampers, Gillette, Crest, Oral-B, Charmin, Bounty, Dawn, Febreze, Old Spice, Head & Shoulders, Pantene, Olay, and about 50 other brands. Walk through your house and count what's theirs — you'll hit double digits before you leave the bathroom. They spend more on advertising than almost any company on earth, which means they heavily influence what shows get made and what content gets funded on TV and online. Here's the part most people miss: P&G is also one of the largest patent holders in consumer chemistry. They don't just make your soap. They invented the formulas that your soap, your competitor's soap, and the store-brand soap are all based on.",
"**Disney**\n\nDisney owns Marvel, Lucasfilm (Star Wars), Pixar, 20th Century Fox, Searchlight Pictures, ESPN, ABC, National Geographic, FX, Hulu, and a controlling stake in streaming across every age group. They own 12 theme parks on three continents. They own the broadcast rights for the NFL, NBA, and college football. When Fox was acquired, Disney became the largest entertainment company in the world — they make what you watch, where you vacation, what your kid wears, and what stories your culture tells itself. One thing people overlook: Disney also owns a massive real estate portfolio. Walt Disney World in Florida is roughly the size of San Francisco, and it operates as its own special tax district with its own zoning authority.",
"**BlackRock**\n\nBlackRock manages over $10 trillion in assets, which makes them the largest asset manager on earth. They're the top or second-largest shareholder in almost every major public company — Apple, Microsoft, Amazon, Google, JPMorgan, you name it. When you invest in an index fund or your 401k holds an ETF, there's a good chance BlackRock built it. Their software system, Aladdin, manages risk for institutions controlling over $20 trillion. But here's the thing most people don't clock: BlackRock doesn't just invest in companies. By holding massive voting shares, they influence corporate governance — executive pay, climate policy, board composition. They're not running the companies, but they're in the room when the decisions get made.",
"**3M**\n\nYou know them for Post-it Notes and Scotch tape, but 3M makes over 60,000 products across every industry you can name. The N95 mask that kept people alive during COVID — that's 3M. The reflective material on highway signs — 3M. The adhesive on your phone screen protector — probably 3M. They make sandpaper, dental fillings, electrical insulation, car wrap film, and the non-stick coating on surgical tools. If something sticks, reflects, filters, or insulates, there's a decent chance 3M invented the material. They hold over 100,000 patents. The company touches your day in at least a dozen ways you'd never guess, from the abrasive in your toothpaste to the film on your laptop screen.",
]
def find_fallback(thing):
if thing:
thing_lower = thing.lower().strip()
for fb in FALLBACKS:
try:
fb_topic = fb.split("**")[1].lower()
if thing_lower == fb_topic or (thing_lower in fb_topic and len(thing_lower) > 5):
return fb
except (IndexError, ValueError):
continue
return random.choice(FALLBACKS)
def map_it(user_input):
company = user_input.strip() if user_input and user_input.strip() else ""
if client and company:
try:
response = client.chat_completion(
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"The company: {company}"},
],
max_tokens=500,
temperature=0.8,
)
result = response.choices[0].message.content
if result and result.strip():
return f"**{company}**\n\n{result.strip()}"
except Exception:
pass
return find_fallback(company)
def map_it_random():
return map_it("")
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.4rem; font-weight: 700;
background: linear-gradient(135deg, #d04040, #d08040);
-webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0;
}
.app-header .sub { color: #777777; font-size: 0.88rem; margin-top: 6px; font-weight: 300; letter-spacing: 0.04em; }
.app-visual { text-align: center; font-size: 5rem; padding: 12px 0 4px; filter: drop-shadow(0 0 20px rgba(208, 64, 64, 0.3)); }
.input-box textarea { background: #ffffff !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: #888888 !important; }
.input-box textarea:focus { border-color: #d04040 !important; box-shadow: 0 0 20px rgba(208, 64, 64, 0.15) !important; }
.input-box label, .output-box label { color: #666666 !important; font-family: 'Space Mono', monospace !important; font-size: 0.75rem !important; letter-spacing: 0.05em !important; }
button.primary { background: linear-gradient(135deg, #d04040, #b03030) !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, 64, 64, 0.3) !important; }
button.primary:hover { box-shadow: 0 4px 30px rgba(208, 64, 64, 0.5) !important; }
button.secondary { background: transparent !important; border: 1px solid rgba(208, 64, 64, 0.3) !important; color: #d04040 !important; font-family: 'Space Mono', monospace !important; font-size: 0.8rem !important; border-radius: 20px !important; }
button.secondary:hover { background: rgba(208, 64, 64, 0.1) !important; }
.output-box .prose { background: #ffffff !important; border: 1px solid #e0e0e8 !important; border-radius: 12px !important; padding: 24px !important; color: #1a1a2e !important; font-size: 0.95rem !important; line-height: 1.7 !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: #ffffff !important;
}
.output-box .prose strong { color: #e08060 !important; font-family: 'Space Mono', monospace !important; }
.footer-text { text-align: center; padding: 20px; color: #777777; font-size: 0.65rem; font-weight: 300; letter-spacing: 0.05em; }
.footer-text a { color: #d04040; text-decoration: none; }
"""
with gr.Blocks(css=CUSTOM_CSS, title="Manopoly", theme=gr.themes.Base()) as demo:
gr.HTML("""
<div class="app-header">
<h1>Manopoly</h1>
<div class="sub">You think you chose them. They chose your whole day.</div>
</div>
""")
with gr.Column(elem_classes="input-box"):
user_input = gr.Textbox(
label="Name a company",
placeholder="Google, Nestle, Amazon, Luxottica, Tyson, BlackRock...",
lines=1, max_lines=1,
)
with gr.Row():
go_btn = gr.Button("Follow the money", 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.Markdown("**Or try one of these:**")
with gr.Row():
ex1 = gr.Button("Google", variant="secondary", size="sm")
ex2 = gr.Button("Amazon", variant="secondary", size="sm")
ex3 = gr.Button("Nestle", variant="secondary", size="sm")
with gr.Row():
ex4 = gr.Button("Disney", variant="secondary", size="sm")
ex5 = gr.Button("BlackRock", variant="secondary", size="sm")
ex6 = gr.Button("surprise me", variant="secondary", size="sm")
go_btn.click(map_it, [user_input], [output])
random_btn.click(map_it_random, [], [output])
ex1.click(lambda: map_it("Google"), [], [output])
ex2.click(lambda: map_it("Amazon"), [], [output])
ex3.click(lambda: map_it("Nestle"), [], [output])
ex4.click(lambda: map_it("Disney"), [], [output])
ex5.click(lambda: map_it("BlackRock"), [], [output])
ex6.click(map_it_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()