Spaces:
Runtime error
Runtime error
little changes
Browse files- .DS_Store +0 -0
- .gitignore +1 -0
- app.py +8 -8
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Improve Your English with Positive News-French Clean Power Ep 800-69274d.mp3
|
app.py
CHANGED
|
@@ -10,8 +10,10 @@ model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")
|
|
| 10 |
|
| 11 |
def transcribe_audio(audio_path):
|
| 12 |
try:
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
with torch.no_grad():
|
| 17 |
logits = model(input_values).logits
|
|
@@ -23,12 +25,10 @@ def transcribe_audio(audio_path):
|
|
| 23 |
return str(e)
|
| 24 |
|
| 25 |
demo = gr.Interface(
|
| 26 |
-
fn
|
| 27 |
-
inputs=
|
| 28 |
outputs='text',
|
| 29 |
-
title="Subtitle
|
| 30 |
-
description="This tool transcribes audio
|
| 31 |
)
|
| 32 |
demo.launch()
|
| 33 |
-
|
| 34 |
-
|
|
|
|
| 10 |
|
| 11 |
def transcribe_audio(audio_path):
|
| 12 |
try:
|
| 13 |
+
# 'sr' = 'sampling_rate'
|
| 14 |
+
audio, sr = librosa.load(audio_path, sr=16000)
|
| 15 |
+
|
| 16 |
+
input_values = processor(audio, return_tensors='pt', sampling_rate=sr).input_values
|
| 17 |
|
| 18 |
with torch.no_grad():
|
| 19 |
logits = model(input_values).logits
|
|
|
|
| 25 |
return str(e)
|
| 26 |
|
| 27 |
demo = gr.Interface(
|
| 28 |
+
fn=transcribe_audio,
|
| 29 |
+
inputs=gr.Audio(type='filepath'),
|
| 30 |
outputs='text',
|
| 31 |
+
title="Subtitle Generator",
|
| 32 |
+
description="This tool transcribes audio files into text"
|
| 33 |
)
|
| 34 |
demo.launch()
|
|
|
|
|
|