Wayfindersix commited on
Commit
1dabcea
·
0 Parent(s):

initial commit

Browse files
Files changed (3) hide show
  1. README.md +24 -0
  2. app.py +147 -0
  3. requirements.txt +2 -0
README.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Apocalypto
3
+ emoji: ☢
4
+ colorFrom: green
5
+ colorTo: gray
6
+ sdk: gradio
7
+ app_file: app.py
8
+ license: mit
9
+ short_description: How ready are you? Really?
10
+ ---
11
+
12
+ # Apocalypto — How Ready Are You? Really?
13
+
14
+ Pick your apocalypse. Find out where you stand.
15
+
16
+ ## What this is
17
+
18
+ Zombie apocalypse. Solar flare. Economic collapse. AI uprising. Pick the scenario, describe what you've got, and get an honest assessment of your survival odds. Survival score, your hidden advantage, and the one thing that'll get you killed first.
19
+
20
+ Gallows humor with a point.
21
+
22
+ ---
23
+
24
+ Heuremen — Let's stay connected and keep information free.
app.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Apocalypto — How Ready Are You? Really?
3
+ Pick your apocalypse. Find out where you stand.
4
+ """
5
+
6
+ import gradio as gr
7
+ import os
8
+ import random
9
+ from huggingface_hub import InferenceClient
10
+
11
+ HF_TOKEN = os.environ.get("HF_TOKEN", "")
12
+ MODEL = "mistralai/Mistral-7B-Instruct-v0.3"
13
+
14
+ client = InferenceClient(model=MODEL, token=HF_TOKEN) if HF_TOKEN else None
15
+
16
+ SYSTEM_PROMPT = """Someone picks an apocalypse scenario and describes what they've got — their skills, supplies, location, physical condition, whatever they share. Your job is to honestly assess how prepared they are. Be funny. Be real. Be specific.
17
+
18
+ Rules:
19
+ - 5 to 7 sentences.
20
+ - Give them a survival score out of 10. Be honest — most people are a 3.
21
+ - Tell them the one thing they have going for them that they probably don't realize.
22
+ - Tell them the one thing that'll get them killed first.
23
+ - Give them one actionable thing they could do this week to improve their odds.
24
+ - Be funny but not mean. This is gallows humor, not bullying.
25
+ - Talk like a friend who watched way too many survival shows and has opinions.
26
+ - Don't be preachy about preparedness. This is entertainment with a point."""
27
+
28
+ SCENARIOS = [
29
+ "zombie apocalypse and I live in an apartment",
30
+ "solar flare knocks out all electronics",
31
+ "economic collapse and I have $200 in savings",
32
+ "AI takes over and I'm not technical",
33
+ "asteroid impact, 6 months warning",
34
+ "supervolcano eruption",
35
+ "global pandemic worse than COVID",
36
+ "nuclear war but I'm far from a target city",
37
+ "all the bees die",
38
+ "water crisis in my city",
39
+ "massive earthquake and I live on the coast",
40
+ "internet goes down permanently",
41
+ "food supply chain collapses",
42
+ "alien contact and they're not friendly",
43
+ "another ice age starts slowly",
44
+ ]
45
+
46
+ FALLBACKS = [
47
+ "**zombie apocalypse and I live in an apartment**\n\nSurvival score: 4/10. Apartments are actually decent short-term — you've got height, a lockable door, and the stairs slow zombies down. The thing you've got going for you that you don't realize: you know every exit in your building because you've been avoiding your neighbors for years. That's recon. The thing that kills you first: you have three days of food, tops. After that you're raiding the bodega downstairs with everyone else. This week: fill every container you own with water. The tap stops working before the zombies reach your floor.",
48
+ "**economic collapse and I have $200 in savings**\n\nSurvival score: 5/10. Here's the thing nobody tells you — in a real collapse, cash is useless pretty fast. Your $200 doesn't matter. What matters is what you can do. Can you fix things? Cook? Grow food? Talk people out of fighting? Those become currency. The thing that'll get you killed: debt. Not because anyone's collecting — because the stress of it makes you make bad decisions when you need to think clearly. This week: learn to make one thing from scratch that people want. Bread. Candles. Soap. Any of those makes you valuable.",
49
+ ]
50
+
51
+
52
+ def assess(scenario_input, details_input):
53
+ scenario = scenario_input.strip() if scenario_input and scenario_input.strip() else random.choice(SCENARIOS)
54
+ details = details_input.strip() if details_input and details_input.strip() else "average person, no special prep"
55
+ prompt = f"Apocalypse scenario: {scenario}\nWhat they've got: {details}"
56
+
57
+ if client:
58
+ try:
59
+ response = client.chat_completion(
60
+ messages=[
61
+ {"role": "system", "content": SYSTEM_PROMPT},
62
+ {"role": "user", "content": prompt},
63
+ ],
64
+ max_tokens=500,
65
+ temperature=0.85,
66
+ )
67
+ result = response.choices[0].message.content
68
+ if not result or not result.strip():
69
+ return random.choice(FALLBACKS)
70
+ return f"**{scenario}**\n\n{result.strip()}"
71
+ except Exception:
72
+ return random.choice(FALLBACKS)
73
+ else:
74
+ return random.choice(FALLBACKS)
75
+
76
+
77
+ def clear():
78
+ return "", "", ""
79
+
80
+
81
+ CUSTOM_CSS = """
82
+ @import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Inter:wght@300;400;500;600&display=swap');
83
+
84
+ body, .gradio-container {
85
+ background: #0a0f06 !important;
86
+ font-family: 'Inter', sans-serif !important;
87
+ color: #d0e0c0 !important;
88
+ }
89
+ footer { display: none !important; }
90
+
91
+ .app-header { text-align: center; padding: 28px 20px 8px; }
92
+ .app-header h1 {
93
+ font-family: 'Space Mono', monospace; font-size: 2.4rem; font-weight: 700;
94
+ background: linear-gradient(135deg, #60a030, #a0c040);
95
+ -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0;
96
+ }
97
+ .app-header .sub { color: #607050; font-size: 0.88rem; margin-top: 6px; font-weight: 300; letter-spacing: 0.04em; }
98
+ .app-visual { text-align: center; font-size: 5rem; padding: 12px 0 4px; filter: drop-shadow(0 0 20px rgba(96, 160, 48, 0.3)); }
99
+
100
+ .input-box textarea { background: #101a08 !important; border: 1px solid rgba(96, 160, 48, 0.25) !important; color: #d0e0c0 !important; font-family: 'Inter', sans-serif !important; border-radius: 12px !important; font-size: 0.95rem !important; }
101
+ .input-box textarea::placeholder { color: #607050 !important; }
102
+ .input-box textarea:focus { border-color: #60a030 !important; box-shadow: 0 0 20px rgba(96, 160, 48, 0.15) !important; }
103
+ .input-box label, .output-box label { color: #607050 !important; font-family: 'Space Mono', monospace !important; font-size: 0.75rem !important; letter-spacing: 0.05em !important; }
104
+
105
+ button.primary { background: linear-gradient(135deg, #60a030, #408020) !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(96, 160, 48, 0.3) !important; }
106
+ button.primary:hover { box-shadow: 0 4px 30px rgba(96, 160, 48, 0.5) !important; }
107
+ button.secondary { background: transparent !important; border: 1px solid rgba(96, 160, 48, 0.3) !important; color: #60a030 !important; font-family: 'Space Mono', monospace !important; font-size: 0.8rem !important; border-radius: 20px !important; }
108
+ button.secondary:hover { background: rgba(96, 160, 48, 0.1) !important; }
109
+
110
+ .output-box .prose { background: #101a08 !important; border: 1px solid rgba(96, 160, 48, 0.15) !important; border-radius: 12px !important; padding: 24px !important; color: #d0e0c0 !important; font-size: 0.95rem !important; line-height: 1.7 !important; }
111
+ .output-box .prose strong { color: #a0d060 !important; font-family: 'Space Mono', monospace !important; }
112
+ .footer-text { text-align: center; padding: 20px; color: #607050; font-size: 0.65rem; font-weight: 300; letter-spacing: 0.05em; }
113
+ .footer-text a { color: #60a030; text-decoration: none; }
114
+ """
115
+
116
+ with gr.Blocks(css=CUSTOM_CSS, title="Apocalypto", theme=gr.themes.Base()) as demo:
117
+ gr.HTML("""
118
+ <div class="app-header">
119
+ <h1>Apocalypto</h1>
120
+ <div class="sub">How ready are you? Really?</div>
121
+ </div>
122
+ <div class="app-visual">☢</div>
123
+ """)
124
+
125
+ with gr.Column(elem_classes="input-box"):
126
+ scenario_input = gr.Textbox(
127
+ label="Pick your apocalypse",
128
+ placeholder="zombie apocalypse, solar flare, economic collapse, AI takeover, asteroid...",
129
+ lines=1, max_lines=1,
130
+ )
131
+ details_input = gr.Textbox(
132
+ label="What have you got? (skills, supplies, location, vibes)",
133
+ placeholder="I live in a suburb, I can cook, I have a dog and a baseball bat...",
134
+ lines=2, max_lines=3,
135
+ )
136
+ with gr.Row():
137
+ go_btn = gr.Button("How dead am I?", variant="primary", size="lg")
138
+ clear_btn = gr.Button("New scenario", variant="secondary", size="sm")
139
+ with gr.Column(elem_classes="output-box"):
140
+ output = gr.Markdown(label="")
141
+
142
+ go_btn.click(assess, [scenario_input, details_input], [output])
143
+ clear_btn.click(clear, [], [scenario_input, details_input, output])
144
+ 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>')
145
+
146
+ if __name__ == "__main__":
147
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio>=5.0.0
2
+ huggingface_hub>=0.20.0