awacke1 commited on
Commit
062a55d
ยท
verified ยท
1 Parent(s): 2ecd8b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +118 -14
app.py CHANGED
@@ -19,10 +19,54 @@ def get_manager():
19
 
20
  cookie_manager = get_manager()
21
 
22
- # ๐Ÿš‚ All aboard the Router Express! Next stop: Destination Page
23
- @st.cache_resource(hash_funcs={"_thread.RLock": lambda _: None})
24
- def init_router():
25
- return stx.Router({"/home": home, "/wild-bill": wild_bill, "/buffalo-bill": buffalo_bill})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  # ๐Ÿก Home on the range
28
  def home():
@@ -39,9 +83,6 @@ def buffalo_bill():
39
  st.title("๐Ÿฆฌ Buffalo Bill Cody: The Showman of the West")
40
  st.markdown(buffalo_bill_story)
41
 
42
- # ๐Ÿš‰ All aboard! The Router is leaving the station!
43
- router = init_router()
44
-
45
  # ๐Ÿงญ Navigation: Don't get lost in the prairie!
46
  chosen_id = stx.tab_bar(data=[
47
  stx.TabBarItemData(id="home", title="Home", description="Start here"),
@@ -54,18 +95,81 @@ if st.session_state.page != chosen_id:
54
  st.session_state.page = chosen_id
55
  st.rerun()
56
 
57
- # ๐Ÿ—บ๏ธ You are here (in case you got lost in a saloon)
58
- router.show_route_view()
59
-
60
  # ๐Ÿ•ฐ๏ธ Remember the last saloon... err, page you visited
61
  cookie_manager.set("last_page", chosen_id)
62
 
63
  # ๐Ÿ“œ Reveal the secrets of your past (visits)
64
  st.sidebar.write(f"Last visited: {cookie_manager.get('last_page')}")
65
 
66
- # ... (rest of the code remains the same)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  # ๐ŸŽฌ That's all, folks!
69
- if __name__ == "__main__":
70
- st.sidebar.markdown("---")
71
- st.sidebar.markdown("Created with โค๏ธ and a lot of ๐Ÿค  using Streamlit")
 
19
 
20
  cookie_manager = get_manager()
21
 
22
+ # Define the stories
23
+ wild_bill_story = """
24
+ # ๐Ÿ”ซ Wild Bill Hickok: The Legendary Gunslinger
25
+
26
+ ## 1. ๐ŸŒŸ Early Life
27
+ - ๐Ÿผ Born James Butler Hickok on May 27, 1837, in Homer, Illinois
28
+ - ๐ŸŒพ Grew up on a farm, developing skills in shooting and horseback riding
29
+ - ๐Ÿž๏ธ Left home at 18 to become a stagecoach driver on the Santa Fe Trail
30
+
31
+ ## 2. ๐Ÿฆธโ€โ™‚๏ธ Rise to Fame
32
+ - ๐Ÿ‘ฎ Became a lawman in Kansas and Nebraska territories
33
+ - ๐ŸŽฏ Earned reputation as a skilled marksman and gunfighter
34
+ - ๐Ÿ“ฐ Featured in dime novels, spreading his fame across the country
35
+
36
+ ## 3. ๐Ÿ™๏ธ Notable Locations
37
+ - ๐ŸŒฝ Rock Creek Station, Nebraska: Site of the McCanles Massacre (1861)
38
+ - ๐Ÿ„ Abilene, Kansas: Served as city marshal (1871)
39
+ - ๐Ÿœ๏ธ Cheyenne, Wyoming: Brief stint as sheriff (1876)
40
+
41
+ ## 4. ๐Ÿ’€ The Fateful Day: August 2, 1876
42
+ - ๐Ÿƒ Playing poker in Nuttal & Mann's Saloon, Deadwood
43
+ - ๐Ÿ”ซ Shot in the back of the head by Jack McCall
44
+ - ๐Ÿ–๏ธ Holding the famous "Dead Man's Hand" - aces and eights
45
+ """
46
+
47
+ buffalo_bill_story = """
48
+ # ๐Ÿฆฌ Buffalo Bill Cody: The Showman of the West
49
+
50
+ ## 1. ๐ŸŒŸ Early Life
51
+ - ๐Ÿผ Born William Frederick Cody on February 26, 1846, in Le Claire, Iowa
52
+ - ๐ŸŽ Began riding horses at a young age
53
+ - ๐Ÿš‚ Worked as a Pony Express rider at age 14
54
+
55
+ ## 2. ๐Ÿ‡ Rise to Fame
56
+ - ๐Ÿฆฌ Earned nickname "Buffalo Bill" as a buffalo hunter for the railroad
57
+ - ๐ŸŽ–๏ธ Served as a scout for the U.S. Army during Indian Wars
58
+ - ๐Ÿ“ฐ Became famous through dime novels about his exploits
59
+
60
+ ## 3. ๐ŸŽช Buffalo Bill's Wild West Show
61
+ - ๐Ÿค  Created the famous traveling show in 1883
62
+ - ๐ŸŒ Toured across America and Europe
63
+ - ๐Ÿน Featured Native Americans, cowboys, and sharpshooters
64
+
65
+ ## 4. ๐ŸŒ… Legacy
66
+ - ๐Ÿ™๏ธ Founded the town of Cody, Wyoming
67
+ - ๐Ÿž๏ธ Advocated for conservation of the American West
68
+ - ๐ŸŽญ Shaped the world's perception of the American frontier
69
+ """
70
 
71
  # ๐Ÿก Home on the range
72
  def home():
 
83
  st.title("๐Ÿฆฌ Buffalo Bill Cody: The Showman of the West")
84
  st.markdown(buffalo_bill_story)
85
 
 
 
 
86
  # ๐Ÿงญ Navigation: Don't get lost in the prairie!
87
  chosen_id = stx.tab_bar(data=[
88
  stx.TabBarItemData(id="home", title="Home", description="Start here"),
 
95
  st.session_state.page = chosen_id
96
  st.rerun()
97
 
 
 
 
98
  # ๐Ÿ•ฐ๏ธ Remember the last saloon... err, page you visited
99
  cookie_manager.set("last_page", chosen_id)
100
 
101
  # ๐Ÿ“œ Reveal the secrets of your past (visits)
102
  st.sidebar.write(f"Last visited: {cookie_manager.get('last_page')}")
103
 
104
+ # Display the content based on the chosen page
105
+ if st.session_state.page == 'home':
106
+ home()
107
+ elif st.session_state.page == 'wild-bill':
108
+ wild_bill()
109
+ elif st.session_state.page == 'buffalo-bill':
110
+ buffalo_bill()
111
+
112
+ # ๐Ÿ‘ข Put your boots on, we're going on a story adventure!
113
+ story_progress = stx.stepper_bar(steps=["Early Life", "Rise to Fame", "Notable Feats", "Legacy"])
114
+ st.sidebar.info(f"Story Progress: Phase #{story_progress}")
115
+
116
+ # ๐Ÿ—บ๏ธ Map: Because even legends need GPS sometimes
117
+ st.subheader("๐Ÿ—บ๏ธ Journey Through the Wild West")
118
+ m = folium.Map(location=[41, -100], zoom_start=4)
119
+
120
+ # ๐Ÿ“ Mark the spots where our legends left their boot prints
121
+ locations = [
122
+ ("Homer, IL", 40.0356, -87.9506, "Wild Bill's first rodeo (birthplace)"),
123
+ ("Rock Creek Station, NE", 40.1116, -97.0564, "Wild Bill's wild time (McCanles Massacre)"),
124
+ ("Abilene, KS", 38.9172, -97.2137, "Wild Bill's badge-wearing days"),
125
+ ("Cheyenne, WY", 41.1400, -104.8202, "Wild Bill's brief sheriff showdown"),
126
+ ("Deadwood, SD", 44.3767, -103.7296, "Wild Bill's last poker game ๐Ÿ˜ข"),
127
+ ("Le Claire, IA", 41.5978, -90.3485, "Buffalo Bill's first 'Yee-haw!' (birthplace)"),
128
+ ("North Platte, NE", 41.1239, -100.7654, "Buffalo Bill's home on the range"),
129
+ ("Cody, WY", 44.5263, -109.0565, "Buffalo Bill's namesake town (no buffaloes were harmed)"),
130
+ ("Denver, CO", 39.7392, -104.9903, "Buffalo Bill's final bow ๐ŸŽญ")
131
+ ]
132
+
133
+ # ๐ŸŽจ Paint the town red... or at least mark it on the map
134
+ for name, lat, lon, desc in locations:
135
+ folium.Marker(
136
+ [lat, lon],
137
+ popup=f"{name}: {desc}",
138
+ tooltip=name
139
+ ).add_to(m)
140
+
141
+ # ๐ŸŒŸ Showcase our masterpiece map
142
+ folium_static(m)
143
+
144
+ # ๐Ÿ“Š Compare our legends (no gunslingers were harmed in the making of this table)
145
+ st.subheader("๐Ÿ“Š Side-by-Side Comparison")
146
+ comparison_data = {
147
+ "Aspect": ["Birth Year", "Death Year", "Nickname Origin", "Primary Occupation", "Famous For", "Colorado Connection", "South Dakota Connection"],
148
+ "Wild Bill Hickok": ["1837", "1876", "Unclear, possibly his wild nose ๐Ÿ‘ƒ", "Lawman, Gunfighter", "Quick Draw McGraw IRL", "Visited (probably for the beer ๐Ÿบ)", "Died in Deadwood (worst poker game ever)"],
149
+ "Buffalo Bill Cody": ["1846", "1917", "Buffalo hunting (not actual buffaloes)", "Showman, Scout", "Wild West Show (wilder than spring break)", "Home in Denver (loved the mountains)", "Performed shows (to rival Deadwood's saloons)"]
150
+ }
151
+
152
+ # ๐ŸŽญ Let the comparison show begin!
153
+ df = pd.DataFrame(comparison_data)
154
+ st.table(df)
155
+
156
+ # ๐ŸŒ… Ride off into the sunset with our conclusion
157
+ st.markdown("""
158
+ ## ๐ŸŒ… Conclusion: Legends of the West
159
+
160
+ Yeehaw! We've corralled the tales of two of the wildest cowboys to ever roam the American frontier! ๐Ÿค 
161
+
162
+ - ๐Ÿ”ซ **Wild Bill Hickok**: The man, the myth, the mustache! He lived fast, died young, and left a good-looking corpse (with a really bad poker hand).
163
+
164
+ - ๐ŸŽช **Buffalo Bill Cody**: The original showman who put the 'wild' in Wild West! He turned frontier life into a circus... literally!
165
+
166
+ These two buckaroos shaped the West faster than a tumbleweed ๐ŸŒฟ rollin' in a tornado! Their legacy is as enduring as the smell of a cowboy's boots after a long cattle drive. ๐Ÿ„๐Ÿ’จ
167
+
168
+ So next time you're sipping sarsaparilla ๐Ÿฅค in a saloon, tip your hat ๐Ÿค  to Wild Bill and Buffalo Bill - the OG influencers of the American West!
169
+
170
+ Remember, in the words of the great philosopher Woody from Toy Story: "There's a snake in my boot!" ๐Ÿ๐Ÿ‘ข (Okay, maybe that's not relevant, but it's still a great quote!)
171
+ """)
172
 
173
  # ๐ŸŽฌ That's all, folks!
174
+ st.sidebar.markdown("---")
175
+ st.sidebar.markdown("Created with โค๏ธ and a lot of ๐Ÿค  using Streamlit")