Illia56 commited on
Commit
e904acf
1 Parent(s): 9ec79cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -34,7 +34,10 @@ st.markdown(DESCRIPTION)
34
 
35
  def get_video_title(youtube_url: str) -> str:
36
  yt = YouTube(youtube_url)
37
- return yt.title
 
 
 
38
 
39
  def transcribe_video(youtube_url: str, path: str) -> List[Document]:
40
  """
@@ -100,12 +103,12 @@ def sidebar():
100
 
101
  if st.session_state.youtube_url:
102
  # Get the video title
103
- video_title = get_video_title(st.session_state.youtube_url)
104
  st.markdown(f"### {video_title}")
105
 
106
  # Embed the video
107
  st.markdown(
108
- f'<iframe width="300" height="200" src="{st.session_state.youtube_url.replace("watch?v=", "embed/")}" frameborder="0" allowfullscreen></iframe>',
109
  unsafe_allow_html=True
110
  )
111
 
 
34
 
35
  def get_video_title(youtube_url: str) -> str:
36
  yt = YouTube(youtube_url)
37
+ embed_url = f"https://www.youtube.com/embed/{yt.video_id}"
38
+ embed_html = f'<iframe width="560" height="315" src="{embed_url}" frameborder="0" allowfullscreen></iframe>'
39
+ return yt.title, embed_html
40
+
41
 
42
  def transcribe_video(youtube_url: str, path: str) -> List[Document]:
43
  """
 
103
 
104
  if st.session_state.youtube_url:
105
  # Get the video title
106
+ video_title, embed_html = get_video_title(st.session_state.youtube_url)
107
  st.markdown(f"### {video_title}")
108
 
109
  # Embed the video
110
  st.markdown(
111
+ embed_html,
112
  unsafe_allow_html=True
113
  )
114