Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import gradio as gr
|
|
4 |
|
5 |
# Load model and processor
|
6 |
model_name = "nada15/wav2vec2-large-xls-r-300m-dm32"
|
7 |
-
processor =
|
8 |
-
model = AutoModelForCTC.from_pretrained(model_name)
|
9 |
|
10 |
def transcribe(audio):
|
11 |
inputs = processor(audio, sampling_rate=16000, return_tensors="pt", padding=True)
|
@@ -17,7 +17,7 @@ def transcribe(audio):
|
|
17 |
# Gradio Interface
|
18 |
interface = gr.Interface(
|
19 |
fn=transcribe,
|
20 |
-
inputs=gr.Audio(source="microphone",
|
21 |
outputs="text",
|
22 |
live=True
|
23 |
)
|
|
|
4 |
|
5 |
# Load model and processor
|
6 |
model_name = "nada15/wav2vec2-large-xls-r-300m-dm32"
|
7 |
+
processor = Wav2Vec2Processor.from_pretrained(model_name)
|
8 |
+
model = AutoModelForCTC.from_pretrained(model_name, ignore_mismatched_sizes=True)
|
9 |
|
10 |
def transcribe(audio):
|
11 |
inputs = processor(audio, sampling_rate=16000, return_tensors="pt", padding=True)
|
|
|
17 |
# Gradio Interface
|
18 |
interface = gr.Interface(
|
19 |
fn=transcribe,
|
20 |
+
inputs=gr.Audio(source="microphone"), # Corrected
|
21 |
outputs="text",
|
22 |
live=True
|
23 |
)
|