Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,5 +4,117 @@ import feedparser
|
|
4 |
import streamlit as st
|
5 |
from functions import *
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
|
|
4 |
import streamlit as st
|
5 |
from functions import *
|
6 |
|
7 |
+
st.title("PodcastGPT Dashboard")
|
8 |
+
|
9 |
+
st.markdown(
|
10 |
+
"""
|
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 |
+
|
16 |
+
col1, col2 = st.columns(2)
|
17 |
+
|
18 |
+
with col1:
|
19 |
+
|
20 |
+
st.image('RSS.png', caption = 'Click RSS')
|
21 |
+
|
22 |
+
with col2:
|
23 |
+
|
24 |
+
st.image('RSS_copy.png',caption='Copy RSS Link')
|
25 |
+
|
26 |
+
st.markdown(
|
27 |
+
"""
|
28 |
+
- Copy the generated link and paste in the sidebar on the left:
|
29 |
+
"""
|
30 |
+
)
|
31 |
+
|
32 |
+
pods = {}
|
33 |
+
|
34 |
+
# Left section - Input fields
|
35 |
+
st.sidebar.header("Podcast RSS Feeds")
|
36 |
+
|
37 |
+
# Input Box
|
38 |
+
podcast_url = st.sidebar.text_input('Please paste the podcast RSS feed link here')
|
39 |
+
|
40 |
+
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)
|
48 |
+
|
49 |
+
for pod in podcast_feed.entries[:5]:
|
50 |
+
podcast_title = pod['title']
|
51 |
+
|
52 |
+
try:
|
53 |
+
podcast_image = pod['image']['href']
|
54 |
+
|
55 |
+
except:
|
56 |
+
podcast_image = ''
|
57 |
+
|
58 |
+
for i in pod['links']:
|
59 |
+
if i['type'] == 'audio/mpeg':
|
60 |
+
podcast_url = i['href']
|
61 |
+
|
62 |
+
pods.update({pod['title']:[podcast_url,podcast_image]})
|
63 |
+
|
64 |
+
#Get the most recent 5 episodes
|
65 |
+
podcast_five_titles = list(pods.keys())
|
66 |
+
|
67 |
+
# Dropdown box
|
68 |
+
st.sidebar.subheader("Available Podcasts Feeds")
|
69 |
+
selected_podcast = st.sidebar.selectbox("Select Podcast", options=podcast_five_titles)
|
70 |
+
|
71 |
+
if selected_podcast:
|
72 |
+
|
73 |
+
st.sidebar.markdown("**Note**: Podcast processing can take upto 5 mins, please be patient.")
|
74 |
+
|
75 |
+
podcast_link = pods[selected_podcast][0]
|
76 |
+
podcast_image = pods[selected_podcast][1]
|
77 |
+
|
78 |
+
# Right section - Newsletter content
|
79 |
+
st.header("Newsletter Content")
|
80 |
+
|
81 |
+
# Display the podcast title
|
82 |
+
st.subheader("Episode Title")
|
83 |
+
st.write(selected_podcast)
|
84 |
+
|
85 |
+
# Display the podcast summary and the cover image in a side-by-side layout
|
86 |
+
col1, col2 = st.columns([7, 3])
|
87 |
+
|
88 |
+
# Get podcast transcription and info
|
89 |
+
podcast_info = process_podcast(podcast_link,'output/')
|
90 |
+
|
91 |
+
with col1:
|
92 |
+
# Display the podcast episode summary
|
93 |
+
st.subheader("Podcast Episode Summary")
|
94 |
+
st.write(podcast_info['podcast_summary'])
|
95 |
+
|
96 |
+
if podcast_image:
|
97 |
+
with col2:
|
98 |
+
st.image(podcast_image, caption="Podcast Cover", width=300, use_column_width=True)
|
99 |
+
|
100 |
+
# Display the podcast guest and their details in a side-by-side layout
|
101 |
+
col3, col4 = st.columns([3, 7])
|
102 |
+
|
103 |
+
with col3:
|
104 |
+
st.subheader("Podcast Guest")
|
105 |
+
st.write(podcast_info['podcast_guest'])
|
106 |
+
|
107 |
+
with col4:
|
108 |
+
st.subheader("Podcast Guest Details")
|
109 |
+
st.write(podcast_info["podcast_guest_title"])
|
110 |
+
st.write(podcast_info["podcast_guest_org"])
|
111 |
+
|
112 |
+
# Display the five key moments
|
113 |
+
st.subheader("Key Moments")
|
114 |
+
key_moments = podcast_info['podcast_highlights']
|
115 |
+
for moment in key_moments.split('\n'):
|
116 |
+
st.markdown(
|
117 |
+
f"<p style='margin-bottom: 5px;'>{moment}</p>", unsafe_allow_html=True)
|
118 |
+
|
119 |
|
120 |
|