sosoxa commited on
Commit
69a317e
1 Parent(s): 2ca3314

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -14
app.py CHANGED
@@ -1,19 +1,14 @@
1
- import gradio as gr
2
- from transformers import pipeline
3
 
4
- image_classifier = pipeline(task="image-classification", model="models/aioxlabs/dvoice-darija")
 
5
 
6
- def predict(input_img):
7
- predictions = image_classifier(input_img)
8
- return input_img, {p["label"]: p["score"] for p in predictions}
9
 
10
- gr_interface = gr.Interface(
11
- predict,
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
- if __name__ == "__main__":
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