nickmuchi commited on
Commit
2c88b84
·
verified ·
1 Parent(s): 454c08e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -49
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
- st.sidebar.markdown("**Note**: Podcast processing can take upto 5 mins, please be patient.")
 
80
 
81
- podcast_link = pods[st.session_state.podcast_selection][0]
82
- podcast_image = pods[st.session_state.podcast_selection][1]
83
-
84
- # Right section - Newsletter content
85
- st.header("Newsletter Content")
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
- with col1:
98
- # Display the podcast episode summary
99
- st.subheader("Podcast Episode Summary")
100
- st.write(podcast_info['podcast_summary'])
101
-
102
- if podcast_image:
103
- with col2:
104
- st.image(podcast_image, caption="Podcast Cover", width=300, use_column_width=True)
105
-
106
- # Display the podcast guest and their details in a side-by-side layout
107
- col3, col4 = st.columns([3, 7])
108
-
109
- with col3:
110
- st.subheader("Podcast Guest")
111
- st.write(podcast_info['podcast_guest'])
112
-
113
- with col4:
114
- st.subheader("Podcast Guest Details")
115
- st.write(podcast_info["podcast_guest_title"])
116
- st.write(podcast_info["podcast_guest_org"])
117
-
118
- # Display the five key moments
119
- st.subheader("Key Moments")
120
- key_moments = podcast_info['podcast_highlights']
121
- for moment in key_moments.split('\n'):
122
- st.markdown(
123
- f"<p style='margin-bottom: 5px;'>{moment}</p>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
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