Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,30 +20,37 @@ def parse_data(filename):
|
|
| 20 |
|
| 21 |
return categories
|
| 22 |
|
| 23 |
-
# Function to create a search URL
|
| 24 |
-
def
|
| 25 |
base_url = "https://www.wikipedia.org/search-redirect.php?family=wikipedia&language=en&search="
|
| 26 |
return base_url + artist_song.replace(' ', '+').replace('β', '%E2%80%93')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Parsing the data
|
| 29 |
data = parse_data("data.txt")
|
| 30 |
|
| 31 |
# Streamlit page configuration
|
| 32 |
-
st.set_page_config(page_title="MTV VMAs 2023 Awards", layout="wide")
|
| 33 |
|
| 34 |
# Main title
|
| 35 |
-
st.title("π Video Awards Presentation Streamlit for 2023!")
|
| 36 |
|
| 37 |
# Displaying data
|
| 38 |
for category, nominees in data.items():
|
| 39 |
st.header(f"{category} πΆ")
|
| 40 |
with st.expander("View Nominees"):
|
| 41 |
for nominee in nominees:
|
| 42 |
-
col1, col2 = st.columns([
|
| 43 |
with col1:
|
| 44 |
st.markdown(f"* {nominee}")
|
| 45 |
with col2:
|
| 46 |
-
st.markdown(f"[Wikipedia]({
|
|
|
|
|
|
|
| 47 |
|
| 48 |
# Footer
|
| 49 |
st.caption("Source: MTV Video Music Awards 2023")
|
|
|
|
| 20 |
|
| 21 |
return categories
|
| 22 |
|
| 23 |
+
# Function to create a search URL for Wikipedia:
|
| 24 |
+
def create_search_url_wikipedia(artist_song):
|
| 25 |
base_url = "https://www.wikipedia.org/search-redirect.php?family=wikipedia&language=en&search="
|
| 26 |
return base_url + artist_song.replace(' ', '+').replace('β', '%E2%80%93')
|
| 27 |
+
|
| 28 |
+
# Function to create a search URL for YouTube:
|
| 29 |
+
def create_search_url_youtube(artist_song):
|
| 30 |
+
base_url = "https://www.youtube.com/results?search_query="
|
| 31 |
+
return base_url + artist_song.replace(' ', '+').replace('β', '%E2%80%93')
|
| 32 |
|
| 33 |
# Parsing the data
|
| 34 |
data = parse_data("data.txt")
|
| 35 |
|
| 36 |
# Streamlit page configuration
|
| 37 |
+
st.set_page_config(page_title="MTV VMAs - 2023 Awards Wikipedia and Youtube", layout="wide")
|
| 38 |
|
| 39 |
# Main title
|
| 40 |
+
st.title("π Video Awards Presentation Streamlit for 2023 with Wikipedia and Youtube!")
|
| 41 |
|
| 42 |
# Displaying data
|
| 43 |
for category, nominees in data.items():
|
| 44 |
st.header(f"{category} πΆ")
|
| 45 |
with st.expander("View Nominees"):
|
| 46 |
for nominee in nominees:
|
| 47 |
+
col1, col2, col3 = st.columns([4, 1, 1])
|
| 48 |
with col1:
|
| 49 |
st.markdown(f"* {nominee}")
|
| 50 |
with col2:
|
| 51 |
+
st.markdown(f"[Wikipedia]({create_search_url_wikipedia(nominee)})")
|
| 52 |
+
with col3:
|
| 53 |
+
st.markdown(f"[YouTube]({create_search_url_youtube(nominee)})")
|
| 54 |
|
| 55 |
# Footer
|
| 56 |
st.caption("Source: MTV Video Music Awards 2023")
|