Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ latest_ep_button = st.sidebar.button("Get latest 5 Episodes")
|
|
| 41 |
|
| 42 |
# st.sidebar.markdown("**Note**: Podcast processing can take upto 5 mins, please be patient.")
|
| 43 |
|
| 44 |
-
if latest_ep_button:
|
| 45 |
|
| 46 |
#Extract the list of episodes for the given podcast
|
| 47 |
podcast_feed = feedparser.parse(podcast_url)
|
|
@@ -69,58 +69,60 @@ if latest_ep_button:
|
|
| 69 |
|
| 70 |
selected_podcast = st.sidebar.selectbox("Select Podcast", options=podcast_five_titles,index=None,key='podcast_selection')
|
| 71 |
|
| 72 |
-
if selected_podcast is not None:
|
| 73 |
-
|
| 74 |
-
if 'podcast_selection' not in st.session_state:
|
| 75 |
-
st.session_state.podcast_selection = selected_podcast
|
| 76 |
-
|
| 77 |
print(selected_podcast)
|
|
|
|
|
|
|
| 78 |
|
| 79 |
-
|
|
|
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
# Display the podcast title
|
| 88 |
-
st.subheader("Episode Title")
|
| 89 |
-
st.write(selected_podcast)
|
| 90 |
-
|
| 91 |
-
# Display the podcast summary and the cover image in a side-by-side layout
|
| 92 |
-
col1, col2 = st.columns([7, 3])
|
| 93 |
-
|
| 94 |
-
# Get podcast transcription and info
|
| 95 |
-
podcast_info = process_podcast(podcast_link)
|
| 96 |
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
|
| 126 |
|
|
|
|
| 41 |
|
| 42 |
# st.sidebar.markdown("**Note**: Podcast processing can take upto 5 mins, please be patient.")
|
| 43 |
|
| 44 |
+
if latest_ep_button is not False:
|
| 45 |
|
| 46 |
#Extract the list of episodes for the given podcast
|
| 47 |
podcast_feed = feedparser.parse(podcast_url)
|
|
|
|
| 69 |
|
| 70 |
selected_podcast = st.sidebar.selectbox("Select Podcast", options=podcast_five_titles,index=None,key='podcast_selection')
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
print(selected_podcast)
|
| 73 |
+
|
| 74 |
+
if selected_podcast is not None:
|
| 75 |
|
| 76 |
+
if 'podcast_selection' not in st.session_state:
|
| 77 |
+
st.session_state.podcast_selection = selected_podcast
|
| 78 |
|
| 79 |
+
print(selected_podcast)
|
| 80 |
+
|
| 81 |
+
st.sidebar.markdown("**Note**: Podcast processing can take upto 5 mins, please be patient.")
|
| 82 |
+
|
| 83 |
+
podcast_link = pods[st.session_state.podcast_selection][0]
|
| 84 |
+
podcast_image = pods[st.session_state.podcast_selection][1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
# Right section - Newsletter content
|
| 87 |
+
st.header("Newsletter Content")
|
| 88 |
+
|
| 89 |
+
# Display the podcast title
|
| 90 |
+
st.subheader("Episode Title")
|
| 91 |
+
st.write(selected_podcast)
|
| 92 |
+
|
| 93 |
+
# Display the podcast summary and the cover image in a side-by-side layout
|
| 94 |
+
col1, col2 = st.columns([7, 3])
|
| 95 |
+
|
| 96 |
+
# Get podcast transcription and info
|
| 97 |
+
podcast_info = process_podcast(podcast_link)
|
| 98 |
+
|
| 99 |
+
with col1:
|
| 100 |
+
# Display the podcast episode summary
|
| 101 |
+
st.subheader("Podcast Episode Summary")
|
| 102 |
+
st.write(podcast_info['podcast_summary'])
|
| 103 |
+
|
| 104 |
+
if podcast_image:
|
| 105 |
+
with col2:
|
| 106 |
+
st.image(podcast_image, caption="Podcast Cover", width=300, use_column_width=True)
|
| 107 |
+
|
| 108 |
+
# Display the podcast guest and their details in a side-by-side layout
|
| 109 |
+
col3, col4 = st.columns([3, 7])
|
| 110 |
+
|
| 111 |
+
with col3:
|
| 112 |
+
st.subheader("Podcast Guest")
|
| 113 |
+
st.write(podcast_info['podcast_guest'])
|
| 114 |
+
|
| 115 |
+
with col4:
|
| 116 |
+
st.subheader("Podcast Guest Details")
|
| 117 |
+
st.write(podcast_info["podcast_guest_title"])
|
| 118 |
+
st.write(podcast_info["podcast_guest_org"])
|
| 119 |
+
|
| 120 |
+
# Display the five key moments
|
| 121 |
+
st.subheader("Key Moments")
|
| 122 |
+
key_moments = podcast_info['podcast_highlights']
|
| 123 |
+
for moment in key_moments.split('\n'):
|
| 124 |
+
st.markdown(
|
| 125 |
+
f"<p style='margin-bottom: 5px;'>{moment}</p>", unsafe_allow_html=True)
|
| 126 |
|
| 127 |
|
| 128 |
|