FarhadMadadzade
commited on
Commit
•
200541c
1
Parent(s):
02cd7fa
fixed regex for date
Browse files
app.py
CHANGED
@@ -8,13 +8,15 @@ import datetime
|
|
8 |
import os
|
9 |
from pydub import AudioSegment
|
10 |
from pydub.silence import split_on_silence
|
|
|
11 |
|
12 |
pipe = pipeline("automatic-speech-recognition", model="Artanis1551/whisper_swedish")
|
13 |
|
14 |
|
15 |
def process_video1(date):
|
16 |
# If the date is not in YYYY-MM-DD format, return an error message
|
17 |
-
|
|
|
18 |
video_path = download_youtube_video(
|
19 |
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
20 |
)
|
|
|
8 |
import os
|
9 |
from pydub import AudioSegment
|
10 |
from pydub.silence import split_on_silence
|
11 |
+
import re
|
12 |
|
13 |
pipe = pipeline("automatic-speech-recognition", model="Artanis1551/whisper_swedish")
|
14 |
|
15 |
|
16 |
def process_video1(date):
|
17 |
# If the date is not in YYYY-MM-DD format, return an error message
|
18 |
+
date_pattern = re.compile(r"\b\d{4}-\d{2}-\d{2}\b")
|
19 |
+
if not date_pattern.match(date):
|
20 |
video_path = download_youtube_video(
|
21 |
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
22 |
)
|