Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,10 +19,54 @@ def get_manager():
|
|
| 19 |
|
| 20 |
cookie_manager = get_manager()
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
# ๐ฌ That's all, folks!
|
| 69 |
-
|
| 70 |
-
|
| 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")
|
|
|