File size: 365 Bytes
d2ab942
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import sys
from transformers import pipeline
audio_file_path = sys.argv[1]
model_name="language-identification"
pipe = pipeline("automatic-speech-recognition", model=model_name, return_language=True)
result = pipe(audio_file_path,generate_kwargs={"task": "transcribe"})        
transcript=result["text"]
language= result['chunks'][0]['language']
print ( language )