Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -29,23 +29,20 @@ def transcribe_speech(audio, progress=gr.Progress()):
|
|
29 |
if audio is None: # Handle the NoneType error for microphone input
|
30 |
return "No audio received."
|
31 |
|
32 |
-
progress(0, desc="Transcribing audio...")
|
33 |
transcription = pipe(audio, chunk_length_s=10)['text']
|
34 |
-
progress(1, desc="Transcription finished")
|
35 |
|
36 |
return replace_symbols_back(transcription)
|
37 |
|
38 |
def transcribe_from_youtube(url, progress=gr.Progress()):
|
39 |
-
progress(0, "
|
40 |
# Download audio from YouTube using pytube
|
41 |
audio_path = YouTube(url).streams.filter(only_audio=True)[0].download(filename="tmp.mp4")
|
42 |
|
43 |
-
progress(50, "Transcribing audio...")
|
44 |
transcription = transcribe_speech(audio_path)
|
45 |
|
46 |
os.remove(audio_path)
|
47 |
|
48 |
-
progress(100, "Done!")
|
49 |
return transcription
|
50 |
|
51 |
def populate_metadata(url):
|
|
|
29 |
if audio is None: # Handle the NoneType error for microphone input
|
30 |
return "No audio received."
|
31 |
|
32 |
+
progress(0.5, desc="Transcribing audio...")
|
33 |
transcription = pipe(audio, chunk_length_s=10)['text']
|
|
|
34 |
|
35 |
return replace_symbols_back(transcription)
|
36 |
|
37 |
def transcribe_from_youtube(url, progress=gr.Progress()):
|
38 |
+
progress(0, "Downloading YouTube audio...")
|
39 |
# Download audio from YouTube using pytube
|
40 |
audio_path = YouTube(url).streams.filter(only_audio=True)[0].download(filename="tmp.mp4")
|
41 |
|
|
|
42 |
transcription = transcribe_speech(audio_path)
|
43 |
|
44 |
os.remove(audio_path)
|
45 |
|
|
|
46 |
return transcription
|
47 |
|
48 |
def populate_metadata(url):
|