Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
3 |
|
4 |
-
# Load the model separately
|
5 |
-
model =
|
6 |
|
7 |
-
# Define
|
8 |
def transcribe(audio):
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Define a CSS string to hide the footer
|
12 |
custom_css = """
|
|
|
1 |
import gradio as gr
|
2 |
+
import torchaudio
|
3 |
+
from speechbrain.pretrained import EncoderClassifier
|
4 |
|
5 |
+
# Load the SpeechBrain model separately
|
6 |
+
model = EncoderClassifier.from_hparams(source="speechbrain/mtl-mimic-voicebank", savedir="tmp")
|
7 |
|
8 |
+
# Define the function to transcribe audio
|
9 |
def transcribe(audio):
|
10 |
+
# Load and process the audio file using torchaudio
|
11 |
+
signal, rate = torchaudio.load(audio)
|
12 |
+
|
13 |
+
# Make predictions using the SpeechBrain model
|
14 |
+
output = model.classify_batch(signal)
|
15 |
+
return output
|
16 |
|
17 |
# Define a CSS string to hide the footer
|
18 |
custom_css = """
|