nickmuchi commited on
Commit
4d12526
·
verified ·
1 Parent(s): 76b4f1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -94
app.py CHANGED
@@ -5,118 +5,87 @@ import streamlit as st
5
  from functions import *
6
 
7
  def main():
8
-
9
  st.title("PodcastGPT Dashboard")
10
 
11
- st.markdown(
12
- """
13
  This app assists busy professionals with transcribing and summarizing Podcasts from [Listen Notes](https://www.listennotes.com/) website by following the below steps:
14
- - Search for your desired podcast from the Listen Notes website and click on the "RSS" tab to generate a unique link to the podcast. Example shown below:
15
- """
16
- )
17
 
18
  col1, col2 = st.columns(2)
19
 
20
  with col1:
21
-
22
- st.image('RSS.png', caption = 'Click RSS')
23
 
24
  with col2:
 
25
 
26
- st.image('RSS_copy.png',caption='Copy RSS Link')
27
-
28
- st.markdown(
29
- """
30
- - Copy the generated link and paste in the sidebar on the left:
31
- """
32
- )
33
-
34
- pods = {}
35
 
36
  # Left section - Input fields
37
  st.sidebar.header("Podcast RSS Feeds")
38
-
39
- # Input Box
40
  podcast_url = st.sidebar.text_input('Please paste the podcast RSS feed link here')
41
-
42
  latest_ep_button = st.sidebar.button("Get latest 5 Episodes")
43
-
44
- # st.sidebar.markdown("**Note**: Podcast processing can take upto 5 mins, please be patient.")
45
-
46
  if latest_ep_button:
47
- # Extract the list of episodes for the given podcast
48
- podcast_feed = feedparser.parse(podcast_url)
49
-
50
- # Ensure you don't exceed the feed's length
51
- num_episodes = min(len(podcast_feed.entries), 5)
52
-
53
- for pod in podcast_feed.entries[:num_episodes]:
54
- podcast_title = pod['title']
55
- podcast_image = pod.get('image', {}).get('href', '')
56
-
57
- episode_url = next((i['href'] for i in pod['links'] if i['type'] == 'audio/mpeg'), None)
58
-
59
- pods[podcast_title] = [episode_url, podcast_image]
60
-
61
- if pods:
62
- # Dropdown box
63
- st.sidebar.subheader("Available Podcasts Feeds")
64
- podcast_five_titles = list(pods.keys())
65
- selected_podcast = st.sidebar.selectbox("Select Podcast", options=podcast_five_titles)
66
-
67
- if selected_podcast:
68
- # Process selected podcast
69
- podcast_link, podcast_image = pods[selected_podcast]
70
-
71
- st.sidebar.markdown("**Note**: Podcast processing can take upto 5 mins, please be patient.")
72
-
73
- podcast_link = pods[st.session_state.podcast_selection][0]
74
- podcast_image = pods[st.session_state.podcast_selection][1]
75
-
76
- # Right section - Newsletter content
77
- st.header("Newsletter Content")
78
-
79
- # Display the podcast title
80
- st.subheader("Episode Title")
81
- st.write(selected_podcast)
82
-
83
- # Display the podcast summary and the cover image in a side-by-side layout
84
- col1, col2 = st.columns([7, 3])
85
-
86
- # Get podcast transcription and info
87
- podcast_info = process_podcast(podcast_link)
88
-
89
- with col1:
90
- # Display the podcast episode summary
91
- st.subheader("Podcast Episode Summary")
92
- st.write(podcast_info['podcast_summary'])
93
-
94
- if podcast_image:
95
- with col2:
96
- st.image(podcast_image, caption="Podcast Cover", width=300, use_column_width=True)
97
-
98
- # Display the podcast guest and their details in a side-by-side layout
99
- col3, col4 = st.columns([3, 7])
100
-
101
- with col3:
102
- st.subheader("Podcast Guest")
103
- st.write(podcast_info['podcast_guest'])
104
-
105
- with col4:
106
- st.subheader("Podcast Guest Details")
107
- st.write(podcast_info["podcast_guest_title"])
108
- st.write(podcast_info["podcast_guest_org"])
109
-
110
- # Display the five key moments
111
- st.subheader("Key Moments")
112
- key_moments = podcast_info['podcast_highlights']
113
- for moment in key_moments.split('\n'):
114
- st.markdown(
115
- f"<p style='margin-bottom: 5px;'>{moment}</p>", unsafe_allow_html=True)
116
 
 
 
 
 
 
117
 
118
- if __name__ == '__main__':
119
- main()
 
 
 
 
 
 
 
 
 
 
 
 
120
 
 
 
 
121
 
 
 
 
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  from functions import *
6
 
7
  def main():
 
8
  st.title("PodcastGPT Dashboard")
9
 
10
+ st.markdown("""
 
11
  This app assists busy professionals with transcribing and summarizing Podcasts from [Listen Notes](https://www.listennotes.com/) website by following the below steps:
12
+ - Search for your desired podcast from the Listen Notes website and click on the "RSS" tab to generate a unique link to the podcast. Example shown below:
13
+ """)
 
14
 
15
  col1, col2 = st.columns(2)
16
 
17
  with col1:
18
+ st.image('RSS.png', caption='Click RSS')
 
19
 
20
  with col2:
21
+ st.image('RSS_copy.png', caption='Copy RSS Link')
22
 
23
+ st.markdown("- Copy the generated link and paste in the sidebar on the left:")
 
 
 
 
 
 
 
 
24
 
25
  # Left section - Input fields
26
  st.sidebar.header("Podcast RSS Feeds")
 
 
27
  podcast_url = st.sidebar.text_input('Please paste the podcast RSS feed link here')
 
28
  latest_ep_button = st.sidebar.button("Get latest 5 Episodes")
29
+
 
 
30
  if latest_ep_button:
31
+ try:
32
+ # Extract the list of episodes for the given podcast
33
+ podcast_feed = feedparser.parse(podcast_url)
34
+ pods = {}
35
+ num_episodes = min(len(podcast_feed.entries), 5)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ for pod in podcast_feed.entries[:num_episodes]:
38
+ podcast_title = pod['title']
39
+ podcast_image = pod.get('image', {}).get('href', '')
40
+ episode_url = next((i['href'] for i in pod['links'] if i['type'] == 'audio/mpeg'), None)
41
+ pods[podcast_title] = [episode_url, podcast_image]
42
 
43
+ if pods:
44
+ # Dropdown box
45
+ st.sidebar.subheader("Available Podcasts Feeds")
46
+ podcast_five_titles = list(pods.keys())
47
+ selected_podcast = st.sidebar.selectbox("Select Podcast", options=podcast_five_titles)
48
+
49
+ if selected_podcast:
50
+ podcast_link, podcast_image = pods[selected_podcast]
51
+
52
+ st.header("Newsletter Content")
53
+
54
+ # Display the podcast title
55
+ st.subheader("Episode Title")
56
+ st.write(selected_podcast)
57
 
58
+ # Display the podcast summary and the cover image
59
+ col1, col2 = st.columns([7, 3])
60
+ podcast_info = process_podcast(podcast_link)
61
 
62
+ with col1:
63
+ st.subheader("Podcast Episode Summary")
64
+ st.write(podcast_info['podcast_summary'])
65
 
66
+ if podcast_image:
67
+ with col2:
68
+ st.image(podcast_image, caption="Podcast Cover", width=300)
69
+
70
+ # Display the podcast guest and their details
71
+ col3, col4 = st.columns([3, 7])
72
+
73
+ with col3:
74
+ st.subheader("Podcast Guest")
75
+ st.write(podcast_info['podcast_guest'])
76
+
77
+ with col4:
78
+ st.subheader("Podcast Guest Details")
79
+ st.write(podcast_info["podcast_guest_title"])
80
+ st.write(podcast_info["podcast_guest_org"])
81
+
82
+ # Display the five key moments
83
+ st.subheader("Key Moments")
84
+ key_moments = podcast_info['podcast_highlights']
85
+ for moment in key_moments.split('\n'):
86
+ st.markdown(f"<p style='margin-bottom: 5px;'>{moment}</p>", unsafe_allow_html=True)
87
+ except Exception as e:
88
+ st.sidebar.error(f"An error occurred: {e}")
89
+
90
+ if __name__ == '__main__':
91
+ main()