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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import folium
|
| 4 |
+
from streamlit_folium import folium_static
|
| 5 |
+
from streamlit_components import html
|
| 6 |
+
|
| 7 |
+
# Set page config
|
| 8 |
+
st.set_page_config(page_title="Wild Bill vs Buffalo Bill", page_icon="π€ ", layout="wide")
|
| 9 |
+
|
| 10 |
+
# Define the stories
|
| 11 |
+
wild_bill_story = """
|
| 12 |
+
# π« Wild Bill Hickok: The Legendary Gunslinger
|
| 13 |
+
|
| 14 |
+
## 1. π Early Life
|
| 15 |
+
- πΌ Born James Butler Hickok on May 27, 1837, in Homer, Illinois
|
| 16 |
+
- πΎ Grew up on a farm, developing skills in shooting and horseback riding
|
| 17 |
+
- ποΈ Left home at 18 to become a stagecoach driver on the Santa Fe Trail
|
| 18 |
+
|
| 19 |
+
... # (The rest of the Wild Bill story remains the same)
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
buffalo_bill_story = """
|
| 23 |
+
# 𦬠Buffalo Bill Cody: The Showman of the West
|
| 24 |
+
|
| 25 |
+
## 1. π Early Life
|
| 26 |
+
- πΌ Born William Frederick Cody on February 26, 1846, in Le Claire, Iowa
|
| 27 |
+
- π Began riding horses at a young age
|
| 28 |
+
- π Worked as a Pony Express rider at age 14
|
| 29 |
+
|
| 30 |
+
... # (The rest of the Buffalo Bill story remains the same)
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
# Sidebar
|
| 34 |
+
st.sidebar.title("π Key Locations & Events")
|
| 35 |
+
|
| 36 |
+
st.sidebar.markdown("""
|
| 37 |
+
## Wild Bill Hickok
|
| 38 |
+
- π‘ Homer, Illinois (Birth)
|
| 39 |
+
- π½ Rock Creek Station, Nebraska
|
| 40 |
+
- π Abilene, Kansas
|
| 41 |
+
- ποΈ Cheyenne, Wyoming
|
| 42 |
+
- πͺ Deadwood, South Dakota (Death)
|
| 43 |
+
|
| 44 |
+
## Buffalo Bill Cody
|
| 45 |
+
- π‘ Le Claire, Iowa (Birth)
|
| 46 |
+
- π½ North Platte, Nebraska
|
| 47 |
+
- ποΈ Cody, Wyoming
|
| 48 |
+
- π Denver, Colorado
|
| 49 |
+
- ποΈ Denver, Colorado (Death)
|
| 50 |
+
""")
|
| 51 |
+
|
| 52 |
+
# Main content
|
| 53 |
+
st.title("π€ Wild Bill Hickok vs Buffalo Bill Cody: A Tale of Two Western Legends")
|
| 54 |
+
|
| 55 |
+
col1, col2 = st.columns(2)
|
| 56 |
+
|
| 57 |
+
with col1:
|
| 58 |
+
st.markdown(wild_bill_story)
|
| 59 |
+
|
| 60 |
+
with col2:
|
| 61 |
+
st.markdown(buffalo_bill_story)
|
| 62 |
+
|
| 63 |
+
# Map
|
| 64 |
+
st.subheader("πΊοΈ Journey Through the Wild West")
|
| 65 |
+
|
| 66 |
+
# Create a base map
|
| 67 |
+
m = folium.Map(location=[41, -100], zoom_start=4)
|
| 68 |
+
|
| 69 |
+
# Add markers for key locations
|
| 70 |
+
locations = [
|
| 71 |
+
("Homer, IL", 40.0356, -87.9506, "Wild Bill Hickok's Birthplace"),
|
| 72 |
+
("Rock Creek Station, NE", 40.1116, -97.0564, "McCanles Massacre Site"),
|
| 73 |
+
("Abilene, KS", 38.9172, -97.2137, "Wild Bill served as Marshal"),
|
| 74 |
+
("Cheyenne, WY", 41.1400, -104.8202, "Wild Bill's brief stint as sheriff"),
|
| 75 |
+
("Deadwood, SD", 44.3767, -103.7296, "Wild Bill's final days and resting place"),
|
| 76 |
+
("Le Claire, IA", 41.5978, -90.3485, "Buffalo Bill's Birthplace"),
|
| 77 |
+
("North Platte, NE", 41.1239, -100.7654, "Buffalo Bill's Scout's Rest Ranch"),
|
| 78 |
+
("Cody, WY", 44.5263, -109.0565, "Town founded by Buffalo Bill"),
|
| 79 |
+
("Denver, CO", 39.7392, -104.9903, "Buffalo Bill's home and final resting place")
|
| 80 |
+
]
|
| 81 |
+
|
| 82 |
+
for name, lat, lon, desc in locations:
|
| 83 |
+
folium.Marker(
|
| 84 |
+
[lat, lon],
|
| 85 |
+
popup=f"{name}: {desc}",
|
| 86 |
+
tooltip=name
|
| 87 |
+
).add_to(m)
|
| 88 |
+
|
| 89 |
+
# Display the map
|
| 90 |
+
folium_static(m)
|
| 91 |
+
|
| 92 |
+
# Add React component for animated timeline
|
| 93 |
+
st.subheader("β³ Animated Timeline")
|
| 94 |
+
|
| 95 |
+
timeline_component = """
|
| 96 |
+
import React, { useState, useEffect } from 'react';
|
| 97 |
+
|
| 98 |
+
const Timeline = () => {
|
| 99 |
+
const [year, setYear] = useState(1837);
|
| 100 |
+
const [event, setEvent] = useState('');
|
| 101 |
+
|
| 102 |
+
const events = {
|
| 103 |
+
1837: "Wild Bill Hickok born",
|
| 104 |
+
1846: "Buffalo Bill Cody born",
|
| 105 |
+
1861: "Wild Bill involved in McCanles Massacre",
|
| 106 |
+
1867: "Buffalo Bill begins hunting buffalo for Kansas Pacific Railroad",
|
| 107 |
+
1871: "Wild Bill becomes marshal of Abilene, Kansas",
|
| 108 |
+
1872: "Buffalo Bill awarded Medal of Honor",
|
| 109 |
+
1876: "Wild Bill assassinated in Deadwood",
|
| 110 |
+
1883: "Buffalo Bill's Wild West show debuts",
|
| 111 |
+
1893: "Buffalo Bill performs at Chicago World's Fair",
|
| 112 |
+
1917: "Buffalo Bill dies in Denver"
|
| 113 |
+
};
|
| 114 |
+
|
| 115 |
+
useEffect(() => {
|
| 116 |
+
const timer = setInterval(() => {
|
| 117 |
+
setYear(prevYear => {
|
| 118 |
+
const newYear = prevYear + 1;
|
| 119 |
+
if (newYear > 1917) return 1837;
|
| 120 |
+
return newYear;
|
| 121 |
+
});
|
| 122 |
+
}, 1000);
|
| 123 |
+
|
| 124 |
+
return () => clearInterval(timer);
|
| 125 |
+
}, []);
|
| 126 |
+
|
| 127 |
+
useEffect(() => {
|
| 128 |
+
setEvent(events[year] || '');
|
| 129 |
+
}, [year]);
|
| 130 |
+
|
| 131 |
+
return (
|
| 132 |
+
<div className="timeline">
|
| 133 |
+
<h2 className="text-2xl font-bold mb-4">Year: {year}</h2>
|
| 134 |
+
<p className="text-lg">{event}</p>
|
| 135 |
+
</div>
|
| 136 |
+
);
|
| 137 |
+
};
|
| 138 |
+
|
| 139 |
+
export default Timeline;
|
| 140 |
+
"""
|
| 141 |
+
|
| 142 |
+
# Use the html component to render the React Timeline
|
| 143 |
+
html(
|
| 144 |
+
f"""
|
| 145 |
+
<div id="react-root"></div>
|
| 146 |
+
<script src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
|
| 147 |
+
<script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
|
| 148 |
+
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
|
| 149 |
+
<script type="text/babel">
|
| 150 |
+
{timeline_component}
|
| 151 |
+
ReactDOM.render(<Timeline />, document.getElementById('react-root'));
|
| 152 |
+
</script>
|
| 153 |
+
"""
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
# Comparison table
|
| 157 |
+
st.subheader("π Side-by-Side Comparison")
|
| 158 |
+
|
| 159 |
+
comparison_data = {
|
| 160 |
+
"Aspect": ["Birth Year", "Death Year", "Nickname Origin", "Primary Occupation", "Famous For", "Colorado Connection", "South Dakota Connection"],
|
| 161 |
+
"Wild Bill Hickok": ["1837", "1876", "Unclear, possibly due to his nose", "Lawman, Gunfighter", "Marksmanship, Gunfights", "Visited during travels", "Died in Deadwood"],
|
| 162 |
+
"Buffalo Bill Cody": ["1846", "1917", "Buffalo hunting skills", "Showman, Scout", "Wild West Show", "Home in Denver", "Performed shows in the state"]
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
df = pd.DataFrame(comparison_data)
|
| 166 |
+
st.table(df)
|
| 167 |
+
|
| 168 |
+
# Conclusion
|
| 169 |
+
st.markdown("""
|
| 170 |
+
## π
Conclusion: Legends of the West
|
| 171 |
+
|
| 172 |
+
Both Wild Bill Hickok and Buffalo Bill Cody played significant roles in shaping the mythology and reality of the American West. While their paths diverged in many ways, both men left an indelible mark on American history and popular culture.
|
| 173 |
+
|
| 174 |
+
- π« **Wild Bill Hickok** embodied the image of the fearless lawman and skilled gunfighter, his life and death becoming the stuff of legend.
|
| 175 |
+
- πͺ **Buffalo Bill Cody** transformed his real-life adventures into grand spectacles, sharing his vision of the West with audiences around the world.
|
| 176 |
+
|
| 177 |
+
Their stories, intertwined with the development of Colorado and South Dakota, continue to captivate our imaginations and remind us of a bygone era in American history.
|
| 178 |
+
""")
|
| 179 |
+
|
| 180 |
+
# Run the Streamlit app
|
| 181 |
+
if __name__ == "__main__":
|
| 182 |
+
st.sidebar.markdown("---")
|
| 183 |
+
st.sidebar.markdown("Created with β€οΈ using Streamlit")
|