Spaces:
Runtime error
Runtime error
alankabisov
commited on
Commit
β’
6c022f9
1
Parent(s):
611b363
ui in process
Browse files
app.py
CHANGED
@@ -1,6 +1,40 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
x = st.slider('Select a value')
|
4 |
-
st.write(x, 'squared is', x * x)
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from urllib.parse import urlparse, parse_qs
|
3 |
|
|
|
|
|
4 |
|
5 |
+
|
6 |
+
def get_videoid_from_url(url:str):
|
7 |
+
url_data = urlparse(url)
|
8 |
+
query = parse_qs(url_data.query)
|
9 |
+
|
10 |
+
try:
|
11 |
+
video_id = query["v"][0]
|
12 |
+
except KeyError:
|
13 |
+
video_id = ''
|
14 |
+
|
15 |
+
return video_id
|
16 |
+
|
17 |
+
|
18 |
+
def main():
|
19 |
+
st.title('YouTube Video Summary π')
|
20 |
+
st.text('This app creates summary for given YouTube video based on transcripts.')
|
21 |
+
|
22 |
+
col1, col2 = st.columns(2)
|
23 |
+
|
24 |
+
with col1:
|
25 |
+
video_id = st.text_input('YouTube Video ID:', placeholder='Live it empty if you want to use example video...')
|
26 |
+
# video_id = 'aircAruvnKk'
|
27 |
+
# video_id = 'https://www.youtube.com/watch?v=aircAruvnKk'
|
28 |
+
st.write(get_videoid_from_url(video_id))
|
29 |
+
|
30 |
+
with col2:
|
31 |
+
st.button('Process')
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
# x = st.slider('Select a value')
|
36 |
+
# st.write(x, 'squared is', x * x)
|
37 |
+
|
38 |
+
|
39 |
+
if __name__ == "__main__":
|
40 |
+
main()
|