Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,14 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
return input_img, {p["label"]: p["score"] for p in predictions}
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
inputs=gr.inputs.Image(label="Select hot dog candidate", source=['upload', 'webcam'], type="pil"),
|
| 13 |
-
outputs=[gr.outputs.Image(label="Processed Image"), gr.outputs.Label(label="Result", num_top_classes=2)],
|
| 14 |
-
title="Hot Dog? Or Not?",
|
| 15 |
-
)
|
| 16 |
|
| 17 |
-
|
| 18 |
-
gr_interface.launch()
|
| 19 |
|
|
|
|
| 1 |
+
from speechbrain.pretrained import EncoderASR
|
| 2 |
+
import soundfile as sf
|
| 3 |
|
| 4 |
+
# Load the pretrained ASR model
|
| 5 |
+
asr_model = EncoderASR.from_hparams(source="aioxlabs/dvoice-darija", savedir="pretrained_models/asr-wav2vec2-dvoice-dar")
|
| 6 |
|
| 7 |
+
# Load the audio file
|
| 8 |
+
audio_input, _ = sf.read("kanbghik.mp3")
|
|
|
|
| 9 |
|
| 10 |
+
# Transcribe the audio
|
| 11 |
+
transcription = asr_model.transcribe_file("kanbghik.mp3")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
print("Transcription:", transcription)
|
|
|
|
| 14 |
|