File size: 392 Bytes
5759877
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import torchaudio
import librosa
from transformers import Wav2Vec2ForCTC,Wav2Vec2Processor,pipeline
processor = Wav2Vec2Processor.from_pretrained(model_name_or_path)
model = Wav2Vec2ForCTC.from_pretrained("m3hrdadfi/wav2vec2-large-xlsr-persian")
def ASR(Audio):
    audiofile=torchaudio.load(Audio,16000)

iface = gr.Interface(fn=ASR, inputs="audio", outputs="text")
iface.launch(share=False)