Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,19 +23,19 @@ def youtube_link(url):
|
|
23 |
|
24 |
def convert_to_wav(path):
|
25 |
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
return f"
|
32 |
|
33 |
def youtube_transcribe(url):
|
34 |
|
35 |
path = youtube_link(url)
|
36 |
path_wav = convert_to_wav(path)
|
37 |
|
38 |
-
audio_dataset = Dataset.from_dict({"audio": [
|
39 |
text = pipe1(audio_dataset["audio"])
|
40 |
|
41 |
return text[0]["text"]
|
|
|
23 |
|
24 |
def convert_to_wav(path):
|
25 |
|
26 |
+
audio = AudioFileClip(path)
|
27 |
|
28 |
+
audio_frame = audio.subclip(0, -2)
|
29 |
+
audio_frame.write_audiofile(f"audio.wav")
|
30 |
|
31 |
+
return f"audio.wav"
|
32 |
|
33 |
def youtube_transcribe(url):
|
34 |
|
35 |
path = youtube_link(url)
|
36 |
path_wav = convert_to_wav(path)
|
37 |
|
38 |
+
audio_dataset = Dataset.from_dict({"audio": [path_wav]}).cast_column("audio", Audio(sampling_rate=16000))
|
39 |
text = pipe1(audio_dataset["audio"])
|
40 |
|
41 |
return text[0]["text"]
|