awacke1 commited on
Commit
2ecd8b8
Β·
verified Β·
1 Parent(s): 998dd75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -67
app.py CHANGED
@@ -14,7 +14,6 @@ if 'page' not in st.session_state:
14
  st.session_state.page = 'home'
15
 
16
  # πŸͺ Cookie Manager: Because even cowboys need snacks
17
- @st.cache_resource
18
  def get_manager():
19
  return stx.CookieManager()
20
 
@@ -51,7 +50,9 @@ chosen_id = stx.tab_bar(data=[
51
  ], default="home")
52
 
53
  # 🐎 Giddy up to the chosen page!
54
- router.route(f"/{chosen_id}")
 
 
55
 
56
  # πŸ—ΊοΈ You are here (in case you got lost in a saloon)
57
  router.show_route_view()
@@ -62,71 +63,7 @@ cookie_manager.set("last_page", chosen_id)
62
  # πŸ“œ Reveal the secrets of your past (visits)
63
  st.sidebar.write(f"Last visited: {cookie_manager.get('last_page')}")
64
 
65
- # πŸ‘’ Put your boots on, we're going on a story adventure!
66
- story_progress = stx.stepper_bar(steps=["Early Life", "Rise to Fame", "Notable Feats", "Legacy"])
67
- st.sidebar.info(f"Story Progress: Phase #{story_progress}")
68
-
69
- # πŸ—ΊοΈ Map: Because even legends need GPS sometimes
70
- st.subheader("πŸ—ΊοΈ Journey Through the Wild West")
71
- m = folium.Map(location=[41, -100], zoom_start=4)
72
-
73
- # πŸ“ Mark the spots where our legends left their boot prints
74
- locations = [
75
- ("Homer, IL", 40.0356, -87.9506, "Wild Bill's first rodeo (birthplace)"),
76
- ("Rock Creek Station, NE", 40.1116, -97.0564, "Wild Bill's wild time (McCanles Massacre)"),
77
- ("Abilene, KS", 38.9172, -97.2137, "Wild Bill's badge-wearing days"),
78
- ("Cheyenne, WY", 41.1400, -104.8202, "Wild Bill's brief sheriff showdown"),
79
- ("Deadwood, SD", 44.3767, -103.7296, "Wild Bill's last poker game 😒"),
80
- ("Le Claire, IA", 41.5978, -90.3485, "Buffalo Bill's first 'Yee-haw!' (birthplace)"),
81
- ("North Platte, NE", 41.1239, -100.7654, "Buffalo Bill's home on the range"),
82
- ("Cody, WY", 44.5263, -109.0565, "Buffalo Bill's namesake town (no buffaloes were harmed)"),
83
- ("Denver, CO", 39.7392, -104.9903, "Buffalo Bill's final bow 🎭")
84
- ]
85
-
86
- # 🎨 Paint the town red... or at least mark it on the map
87
- for name, lat, lon, desc in locations:
88
- folium.Marker(
89
- [lat, lon],
90
- popup=f"{name}: {desc}",
91
- tooltip=name
92
- ).add_to(m)
93
-
94
- # 🌟 Showcase our masterpiece map
95
- folium_static(m)
96
-
97
- # πŸ“Š Compare our legends (no gunslingers were harmed in the making of this table)
98
- st.subheader("πŸ“Š Side-by-Side Comparison")
99
- comparison_data = {
100
- "Aspect": ["Birth Year", "Death Year", "Nickname Origin", "Primary Occupation", "Famous For", "Colorado Connection", "South Dakota Connection"],
101
- "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)"],
102
- "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)"]
103
- }
104
-
105
- # 🎭 Let the comparison show begin!
106
- df = pd.DataFrame(comparison_data)
107
- st.table(df)
108
-
109
- # πŸ–ΌοΈ A picture's worth a thousand yeehaws!
110
- st.subheader("Wild West Imagery")
111
- image_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Wild_Bill_Hickok_1869.jpg/800px-Wild_Bill_Hickok_1869.jpg"
112
- stx.bouncing_image(image_source=image_url, animate=True, animation_time=1500, height=300, width=200)
113
-
114
- # πŸŒ… Ride off into the sunset with our conclusion
115
- st.markdown("""
116
- ## πŸŒ… Conclusion: Legends of the West
117
-
118
- Yeehaw! We've corralled the tales of two of the wildest cowboys to ever roam the American frontier! 🀠
119
-
120
- - πŸ”« **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).
121
-
122
- - πŸŽͺ **Buffalo Bill Cody**: The original showman who put the 'wild' in Wild West! He turned frontier life into a circus... literally!
123
-
124
- These two buckaroos shaped the West faster than a tumbleweek 🌿 rollin' in a tornado! Their legacy is as enduring as the smell of a cowboy's boots after a long cattle drive. πŸ„πŸ’¨
125
-
126
- 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!
127
-
128
- 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!)
129
- """)
130
 
131
  # 🎬 That's all, folks!
132
  if __name__ == "__main__":
 
14
  st.session_state.page = 'home'
15
 
16
  # πŸͺ Cookie Manager: Because even cowboys need snacks
 
17
  def get_manager():
18
  return stx.CookieManager()
19
 
 
50
  ], default="home")
51
 
52
  # 🐎 Giddy up to the chosen page!
53
+ 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()
 
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__":