ariG23498 HF Staff commited on
Commit
9aece88
·
verified ·
1 Parent(s): 6fc794c

Upload nvidia_parakeet-ctc-0.6b-Vietnamese_0.py with huggingface_hub

Browse files
nvidia_parakeet-ctc-0.6b-Vietnamese_0.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # /// script
2
+ # requires-python = ">=3.12"
3
+ # dependencies = [
4
+ # "numpy",
5
+ # "einops",
6
+ # "pandas",
7
+ # "matplotlib",
8
+ # "protobuf",
9
+ # "torch",
10
+ # "sentencepiece",
11
+ # "torchvision",
12
+ # "transformers",
13
+ # "timm",
14
+ # "diffusers",
15
+ # "sentence-transformers",
16
+ # "accelerate",
17
+ # "peft",
18
+ # "slack-sdk",
19
+ # ]
20
+ # ///
21
+
22
+ try:
23
+ import nemo.collections.asr as nemo_asr
24
+ asr_model = nemo_asr.models.ASRModel.from_pretrained("nvidia/parakeet-ctc-0.6b-Vietnamese")
25
+
26
+ transcriptions = asr_model.transcribe(["file.wav"])
27
+ with open('nvidia_parakeet-ctc-0.6b-Vietnamese_0.txt', 'w', encoding='utf-8') as f:
28
+ f.write('Everything was good in nvidia_parakeet-ctc-0.6b-Vietnamese_0.txt')
29
+ except Exception as e:
30
+ import os
31
+ from slack_sdk import WebClient
32
+ client = WebClient(token=os.environ['SLACK_TOKEN'])
33
+ client.chat_postMessage(
34
+ channel='#hub-model-metadata-snippets-sprint',
35
+ text='Problem in <https://huggingface.co/datasets/model-metadata/code_execution_files/blob/main/nvidia_parakeet-ctc-0.6b-Vietnamese_0.txt|nvidia_parakeet-ctc-0.6b-Vietnamese_0.txt>',
36
+ )
37
+
38
+ with open('nvidia_parakeet-ctc-0.6b-Vietnamese_0.txt', 'a', encoding='utf-8') as f:
39
+ import traceback
40
+ f.write('''```CODE:
41
+ import nemo.collections.asr as nemo_asr
42
+ asr_model = nemo_asr.models.ASRModel.from_pretrained("nvidia/parakeet-ctc-0.6b-Vietnamese")
43
+
44
+ transcriptions = asr_model.transcribe(["file.wav"])
45
+ ```
46
+
47
+ ERROR:
48
+ ''')
49
+ traceback.print_exc(file=f)
50
+
51
+ finally:
52
+ from huggingface_hub import upload_file
53
+ upload_file(
54
+ path_or_fileobj='nvidia_parakeet-ctc-0.6b-Vietnamese_0.txt',
55
+ repo_id='model-metadata/code_execution_files',
56
+ path_in_repo='nvidia_parakeet-ctc-0.6b-Vietnamese_0.txt',
57
+ repo_type='dataset',
58
+ )