igortamara commited on
Commit
b34a77f
·
1 Parent(s): b00ca20

Changed to use argentinian female voice

Browse files
Files changed (2) hide show
  1. README.md +26 -4
  2. app.py +19 -10
README.md CHANGED
@@ -1,13 +1,35 @@
1
  ---
2
- title: persian-tts-piper
3
  emoji: 🌍
4
- colorFrom: blue
5
  colorTo: blue
6
  sdk: gradio
7
- sdk_version: 5.13.1
8
  app_file: app.py
 
9
  pinned: false
10
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
1
  ---
2
+ title: Piper showcasing trained argentinian female voice
3
  emoji: 🌍
4
+ colorFrom: indigo
5
  colorTo: blue
6
  sdk: gradio
7
+ sdk_version: 5.34.2
8
  app_file: app.py
9
+ short-description: A sample of the Piper Model with Argentinian female voice
10
  pinned: false
11
  license: mit
12
+ disable_embedding: true
13
+ language:
14
+ - es
15
+ tags:
16
+ - piper
17
+ - tts
18
+ - text-to-speech
19
+ - onnx
20
+ - español
21
+ base_model:
22
+ - rhasspy/piper-voices
23
+ models:
24
+ - gyroing/Persian-Piper-Model-gyro
25
+ - rhasspy/piper-voices
26
+ - larcanio/piper-voices
27
  ---
28
 
29
+ This is a sample showcasing how to use [Piper](https://github.com/rhasspy/piper) with [Gradio](https://github.com/gradio-app/gradio) to create a TTS app with Argentinian female voice.
30
+
31
+ ## References
32
+
33
+ - [Piper](https://github.com/rhasspy/piper)
34
+ - [Argentinian Female Voice](https://huggingface.co/larcanio/piper-voices)
35
+ - [Persian Female Voice](https://huggingface.co/gyroing/Persian-Piper-Model-gyro)
app.py CHANGED
@@ -3,12 +3,12 @@ import wave
3
  import numpy as np
4
  from io import BytesIO
5
  from huggingface_hub import hf_hub_download
6
- from piper import PiperVoice
7
  from transformers import pipeline
8
  import typing
9
 
10
- model_path = hf_hub_download(repo_id="gyroing/Persian-Piper-Model-gyro", filename="fa_IR-gyro-medium.onnx")
11
- config_path = hf_hub_download(repo_id="gyroing/Persian-Piper-Model-gyro", filename="fa_IR-gyro-medium.onnx.json")
12
  voice = PiperVoice.load(model_path, config_path)
13
 
14
 
@@ -32,15 +32,24 @@ def synthesize_speech(text):
32
 
33
  return audio_data.tobytes(), None
34
 
 
 
 
 
 
 
 
 
 
 
35
  # Using Gradio Blocks
36
  with gr.Blocks(theme=gr.themes.Base()) as blocks:
37
- gr.Markdown("# Persian Text to Speech Synthesizer")
38
- gr.Markdown("Enter text to synthesize it into speech using Piper With Persian gyro Model :")
39
- input_text = gr.Textbox(label=" ", rtl=True , text_align="right" )
40
- output_audio = gr.Audio(label="Synthesized Speech", type="numpy")
41
- output_text = gr.Textbox(label="Output Text", visible=False, rtl=True) # This is the new text output component
42
- submit_button = gr.Button("Synthesize")
43
 
44
  submit_button.click(synthesize_speech, inputs=input_text, outputs=[output_audio, output_text])
45
  # Run the app
46
- blocks.launch()
 
3
  import numpy as np
4
  from io import BytesIO
5
  from huggingface_hub import hf_hub_download
6
+ from piper import PiperVoice
7
  from transformers import pipeline
8
  import typing
9
 
10
+ model_path = hf_hub_download(repo_id="larcanio/piper-voices", filename="es_AR-daniela-high.onnx")
11
+ config_path = hf_hub_download(repo_id="larcanio/piper-voices", filename="es_AR-daniela-high.json")
12
  voice = PiperVoice.load(model_path, config_path)
13
 
14
 
 
32
 
33
  return audio_data.tobytes(), None
34
 
35
+ BANNER_TEXT = """
36
+ # Demo en español argentino con Piper
37
+
38
+ [***Piper***](https://huggingface.co/rhasspy/piper-voices/) es un modelo de abierto de Texto a Voz (TTS)
39
+ que permite entrenarse con voz propia, destaca por no requerir conectarse a Internet y ofrecer resultados
40
+ sin exigir GPU. Inicialmente diseñado para Raspberri Pi.
41
+
42
+ Este demo solo muestra español, puedes probar [voces en otros idiomas](https://rhasspy.github.io/piper-samples/).
43
+ """
44
+
45
  # Using Gradio Blocks
46
  with gr.Blocks(theme=gr.themes.Base()) as blocks:
47
+ gr.Markdown(BANNER_TEXT)
48
+ input_text = gr.Textbox(label=" ", placeholder="Introduce el texto a leer aquí")
49
+ output_audio = gr.Audio(label="Audio generado", type="numpy")
50
+ output_text = gr.Textbox(label="Tokens generados", visible=False)
51
+ submit_button = gr.Button("Genera audio")
 
52
 
53
  submit_button.click(synthesize_speech, inputs=input_text, outputs=[output_audio, output_text])
54
  # Run the app
55
+ blocks.launch()