Thorsten-Voice commited on
Commit
6c0f0b9
1 Parent(s): cc60a92

First working - but not beautiful - version (hopefully)

Browse files
Files changed (1) hide show
  1. app.py +35 -15
app.py CHANGED
@@ -6,27 +6,42 @@ import numpy as np
6
  from TTS.utils.manage import ModelManager
7
  from TTS.utils.synthesizer import Synthesizer
8
 
9
- st.title("Demo Thorsten-Voice")
10
- st.header("Eine kostenlose, deutsche ...")
 
 
 
11
 
12
- text = st.text_area("Zu sprechender Text",max_chars=100)
13
  model = st.radio("Welches Thorsten-Voice Modell möchtest Du testen?",
14
  ('Thorsten-VITS','Thorsten-DDC'))
15
 
16
- # Load Thorsten-Voice TTS/Vocoder models
17
- # Thanks to Coqui for inspiration and code snipplets :-)
18
- manager = ModelManager()
19
- model_path, config_path, model_item = manager.download_model("tts_models/de/thorsten/vits")
20
- vocoder_name: Optional[str] = model_item["default_vocoder"]
21
- vocoder_path = None
22
- vocoder_config_path = None
23
- if vocoder_name is not None:
24
- vocoder_path, vocoder_config_path, _ = manager.download_model(vocoder_name)
 
 
 
 
 
 
 
25
 
26
- synthesizer = Synthesizer(
27
- model_path, config_path, None, None, vocoder_path, vocoder_config_path,)
 
 
 
 
 
 
28
 
29
- if text:
30
  wav = synthesizer.tts(text)
31
  filename = tempfile.NamedTemporaryFile(suffix=".wav", delete=False)
32
  synthesizer.save_wav(wav, filename)
@@ -36,3 +51,8 @@ if text:
36
 
37
  st.audio(audio_bytes,format="audio/wav")
38
 
 
 
 
 
 
 
6
  from TTS.utils.manage import ModelManager
7
  from TTS.utils.synthesizer import Synthesizer
8
 
9
+ st.title("Thorsten-Voice - einfach ausprobieren")
10
+ st.markdown("* 🇩🇪 Eine qualititativ hochwertige, deutsche, künstliche Stimme, die offline erzeugt werden kann, sollte jedem Projekt kostenlos und ohne lizenzrechtliche Einschränkungen zur Verfügung stehen.")
11
+ st.markdown("* 🇺🇸 A high-quality German artificial voice that can be generated offline should be available to any project free of charge and without any licensing restrictions.")
12
+ st.markdown("* Ein ⭐ ist gerne gesehen (https://github.com/thorstenMueller/Thorsten-Voice)")
13
+ st.markdown("* Und das Abo meines Youtube Kanals nicht vergessen: https://www.youtube.com/@ThorstenMueller")
14
 
15
+ text = st.text_area("Zu sprechender Text",max_chars=250)
16
  model = st.radio("Welches Thorsten-Voice Modell möchtest Du testen?",
17
  ('Thorsten-VITS','Thorsten-DDC'))
18
 
19
+ if text:
20
+ # Load Thorsten-Voice TTS/Vocoder models
21
+ # Thanks to Coqui for inspiration and code snipplets :)
22
+ manager = ModelManager()
23
+
24
+ if model == "Thorsten-VITS":
25
+ model_path, config_path, model_item = manager.download_model("tts_models/de/thorsten/vits")
26
+ code = '''pip install tts==0.8.0
27
+ tts-server --model_name tts_models/de/thorsten/vits
28
+ http://localhost:5002'''
29
+
30
+ if model == "Thorsten-DDC":
31
+ model_path, config_path, model_item = manager.download_model("tts_models/de/thorsten/tacotron2-DDC")
32
+ code = '''pip install tts==0.8.0
33
+ tts-server --model_name tts_models/de/thorsten/tacotron2-DDC
34
+ http://localhost:5002'''
35
 
36
+ vocoder_name: Optional[str] = model_item["default_vocoder"]
37
+ vocoder_path = None
38
+ vocoder_config_path = None
39
+ if vocoder_name is not None:
40
+ vocoder_path, vocoder_config_path, _ = manager.download_model(vocoder_name)
41
+
42
+ synthesizer = Synthesizer(
43
+ model_path, config_path, None, None, vocoder_path, vocoder_config_path,)
44
 
 
45
  wav = synthesizer.tts(text)
46
  filename = tempfile.NamedTemporaryFile(suffix=".wav", delete=False)
47
  synthesizer.save_wav(wav, filename)
 
51
 
52
  st.audio(audio_bytes,format="audio/wav")
53
 
54
+ st.header("Thorsten-Voice lokal ausführen:")
55
+ st.code(code, language='shell')
56
+
57
+ # TODO: st.write("Mit diesen Kommandos kannst Du die Stimme lokal nutzen")
58
+