ariG23498 HF Staff commited on
Commit
1bfe29e
·
verified ·
1 Parent(s): 85f5b69

Upload Supertone_supertonic_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. Supertone_supertonic_0.py +18 -8
Supertone_supertonic_0.py CHANGED
@@ -20,11 +20,16 @@
20
  # ///
21
 
22
  try:
23
- // npm i @huggingface/transformers
24
- import { pipeline } from '@huggingface/transformers';
25
 
26
- // Allocate pipeline
27
- const pipe = await pipeline('text-to-speech', 'Supertone/supertonic');
 
 
 
 
 
 
28
  with open('Supertone_supertonic_0.txt', 'w', encoding='utf-8') as f:
29
  f.write('Everything was good in Supertone_supertonic_0.txt')
30
  except Exception as e:
@@ -39,11 +44,16 @@ except Exception as e:
39
  with open('Supertone_supertonic_0.txt', 'a', encoding='utf-8') as f:
40
  import traceback
41
  f.write('''```CODE:
42
- // npm i @huggingface/transformers
43
- import { pipeline } from '@huggingface/transformers';
 
 
 
 
 
 
44
 
45
- // Allocate pipeline
46
- const pipe = await pipeline('text-to-speech', 'Supertone/supertonic');
47
  ```
48
 
49
  ERROR:
 
20
  # ///
21
 
22
  try:
23
+ from supertonic import TTS
 
24
 
25
+ tts = TTS(auto_download=True)
26
+
27
+ style = tts.get_voice_style(voice_name="M1")
28
+
29
+ text = "The train delay was announced at 4:45 PM on Wed, Apr 3, 2024 due to track maintenance."
30
+ wav, duration = tts.synthesize(text, voice_style=style)
31
+
32
+ tts.save_audio(wav, "output.wav")
33
  with open('Supertone_supertonic_0.txt', 'w', encoding='utf-8') as f:
34
  f.write('Everything was good in Supertone_supertonic_0.txt')
35
  except Exception as e:
 
44
  with open('Supertone_supertonic_0.txt', 'a', encoding='utf-8') as f:
45
  import traceback
46
  f.write('''```CODE:
47
+ from supertonic import TTS
48
+
49
+ tts = TTS(auto_download=True)
50
+
51
+ style = tts.get_voice_style(voice_name="M1")
52
+
53
+ text = "The train delay was announced at 4:45 PM on Wed, Apr 3, 2024 due to track maintenance."
54
+ wav, duration = tts.synthesize(text, voice_style=style)
55
 
56
+ tts.save_audio(wav, "output.wav")
 
57
  ```
58
 
59
  ERROR: