heisenberg3376 commited on
Commit
4a338b9
·
verified ·
1 Parent(s): ecb891f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -16
app.py CHANGED
@@ -1,18 +1,3 @@
1
  import gradio as gr
2
- from transformers import WhisperProcessor, WhisperForConditionalGeneration
3
- import torchaudio
4
 
5
- # Load model and processor
6
- model_id = "heisenberg3376/whisper-small-finetuned-telugu"
7
- processor = WhisperProcessor.from_pretrained(model_id)
8
- model = WhisperForConditionalGeneration.from_pretrained(model_id)
9
-
10
- def transcribe(audio_path):
11
- waveform, sr = torchaudio.load(audio_path)
12
- if sr != 16000:
13
- waveform = torchaudio.transforms.Resample(sr, 16000)(waveform)
14
- input_feats = processor(waveform.squeeze(), sampling_rate=16000, return_tensors="pt").input_features
15
- pred_ids = model.generate(input_feats)
16
- return str(processor.decode(pred_ids[0], skip_special_tokens=True))
17
-
18
- gr.Interface(fn=transcribe, inputs=gr.Audio(type="filepath"), outputs="text", title="Telugu ASR").launch()
 
1
  import gradio as gr
 
 
2
 
3
+ gr.load("heisenberg3376/whisper-small-finetuned-telugu").launch()