Upload usage.py
Browse files
usage.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
audio_file_path = sys.argv[1]
|
| 4 |
+
model_name="language-identification"
|
| 5 |
+
pipe = pipeline("automatic-speech-recognition", model=model_name, return_language=True)
|
| 6 |
+
result = pipe(audio_file_path,generate_kwargs={"task": "transcribe"})
|
| 7 |
+
transcript=result["text"]
|
| 8 |
+
language= result['chunks'][0]['language']
|
| 9 |
+
print ( language )
|