someshb07 commited on
Commit
e8f1cde
·
verified ·
1 Parent(s): 7cfa484

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -7,6 +7,24 @@ import gradio
7
 
8
  pipe = pipeline("summarization", model="Falconsai/text_summarization")
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  def summary(text_transcript):
11
  output = pipe(text_transcript)
12
  return output[0]['summary_text']
 
7
 
8
  pipe = pipeline("summarization", model="Falconsai/text_summarization")
9
 
10
+ def extract_youtube_id(url):
11
+ """
12
+ Extracts the YouTube video ID from a given URL.
13
+
14
+ Args:
15
+ url (str): The YouTube video URL.
16
+
17
+ Returns:
18
+ str: The extracted video ID, or None if no match is found.
19
+ """
20
+ # Regular expression to match YouTube video IDs
21
+ pattern = r"(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})"
22
+ match = re.search(pattern, url)
23
+
24
+ if match:
25
+ return match.group(1)
26
+ return None
27
+
28
  def summary(text_transcript):
29
  output = pipe(text_transcript)
30
  return output[0]['summary_text']