Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import torch
|
|
3 |
import torchaudio
|
4 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
5 |
|
6 |
-
# Load
|
7 |
model_name = "Futuresony/Future-sw_ASR-24-02-2025"
|
8 |
processor = Wav2Vec2Processor.from_pretrained(model_name)
|
9 |
model = Wav2Vec2ForCTC.from_pretrained(model_name)
|
@@ -29,9 +29,9 @@ def transcribe_live(microphone_audio):
|
|
29 |
# Create Gradio interface with live microphone input
|
30 |
interface = gr.Interface(
|
31 |
fn=transcribe_live,
|
32 |
-
inputs=gr.Audio(
|
33 |
outputs="text",
|
34 |
-
live=True,
|
35 |
title="Live Swahili ASR Transcription",
|
36 |
description="Speak into your microphone, and the model will transcribe in real-time.",
|
37 |
)
|
@@ -39,4 +39,3 @@ interface = gr.Interface(
|
|
39 |
# Launch the app
|
40 |
if __name__ == "__main__":
|
41 |
interface.launch()
|
42 |
-
|
|
|
3 |
import torchaudio
|
4 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
5 |
|
6 |
+
# Load the Swahili ASR model
|
7 |
model_name = "Futuresony/Future-sw_ASR-24-02-2025"
|
8 |
processor = Wav2Vec2Processor.from_pretrained(model_name)
|
9 |
model = Wav2Vec2ForCTC.from_pretrained(model_name)
|
|
|
29 |
# Create Gradio interface with live microphone input
|
30 |
interface = gr.Interface(
|
31 |
fn=transcribe_live,
|
32 |
+
inputs=gr.Audio(sources=["microphone"], type="filepath"),
|
33 |
outputs="text",
|
34 |
+
live=True,
|
35 |
title="Live Swahili ASR Transcription",
|
36 |
description="Speak into your microphone, and the model will transcribe in real-time.",
|
37 |
)
|
|
|
39 |
# Launch the app
|
40 |
if __name__ == "__main__":
|
41 |
interface.launch()
|
|