KevlarVK commited on
Commit
e3e2bbf
1 Parent(s): 7b85906

Revert "Fixed code repetition"

Browse files

This reverts commit 7b859068757d94bb62122ed3bd5cf358e1ba59de.

Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -149,6 +149,20 @@ elif input_type == "Media":
149
  else:
150
  youtube_url = st.text_input("Enter YouTube URL here", placeholder="Enter URL to an YouTube video", label_visibility="visible")
151
  if youtube_url:
152
- show_buttons("youtube_url", youtube_url)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
 
 
149
  else:
150
  youtube_url = st.text_input("Enter YouTube URL here", placeholder="Enter URL to an YouTube video", label_visibility="visible")
151
  if youtube_url:
152
+ if not get_text(url):
153
+ try:
154
+ try:
155
+ with st.spinner("Fetching text from video..."):
156
+ text_to_summarize = get_text_from_youtube_url(youtube_url)
157
+ except:
158
+ with st.spinner("Captions not available. Downloading video..."):
159
+ get_yt_video(youtube_url)
160
+ text_to_summarize = get_text(url)
161
+ except:
162
+ st.error("Unable to fetch text from video. Please try a different video.")
163
+ text_to_summarize = None
164
+ else:
165
+ text_to_summarize = get_text(url)
166
+ st.markdown("#### Text from video:")
167
 
168