flavioschneider commited on
Commit
770a448
·
1 Parent(s): 1c297dc

feat: update to eleven multilingual v2

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -11,12 +11,12 @@ def pad_buffer(audio):
11
  audio = audio + b'\0' * (element_size - (buffer_size % element_size))
12
  return audio
13
 
14
- def generate_voice(text, voice_name, model_name):
15
  try:
16
  audio = generate(
17
  text[:250], # Limit to 250 characters
18
  voice=voice_name,
19
- model=model_name
20
  )
21
  return (44100, np.frombuffer(pad_buffer(audio), dtype=np.int16))
22
  except UnauthenticatedRateLimitError as e:
@@ -46,36 +46,29 @@ badges = """
46
  """
47
 
48
  description = """
49
- A demo of the world's most advanced TTS systems, made by [ElevenLabs](https://elevenlabs.io). Eleven Monolingual is designed to generate highly realistic voices in English, where Eleven Multilingual is a single model supporting multiple languages including English, German, Polish, Spanish, Italian, French, Portuguese, and Hindi. Sign up on [ElevenLabs](https://elevenlabs.io) to get fast access, long-form generation, voice cloning, API keys, and more!
50
  """
51
 
52
  with gr.Blocks() as block:
53
- gr.Markdown('[ ![ElevenLabs](https://user-images.githubusercontent.com/12028621/243114574-21267d89-5e82-4e7e-9c81-caf30b237683.png) ](https://elevenlabs.io)')
54
  gr.Markdown(badges)
55
  gr.Markdown(description)
56
 
57
  input_text = gr.Textbox(
58
  label="Input Text (250 characters max)",
59
  lines=2,
60
- value="Hahaha OHH MY GOD! This is SOOO funny, I-I am Eleven a text-to-speech system!",
61
  elem_id="input_text"
62
  )
63
 
64
  all_voices = voices()
65
  input_voice = gr.Dropdown(
66
  [ voice.name for voice in all_voices ],
67
- value="Arnold",
68
  label="Voice",
69
  elem_id="input_voice"
70
  )
71
 
72
- input_model = gr.Radio(
73
- ["eleven_monolingual_v1", "eleven_multilingual_v1"],
74
- label="Model",
75
- value="eleven_monolingual_v1",
76
- elem_id="input_model",
77
- )
78
-
79
  run_button = gr.Button(
80
  text="Generate Voice",
81
  type="button"
@@ -87,7 +80,7 @@ with gr.Blocks() as block:
87
  elem_id="out_audio"
88
  )
89
 
90
- inputs = [input_text, input_voice, input_model]
91
  outputs = [out_audio]
92
 
93
  run_button.click(
 
11
  audio = audio + b'\0' * (element_size - (buffer_size % element_size))
12
  return audio
13
 
14
+ def generate_voice(text, voice_name):
15
  try:
16
  audio = generate(
17
  text[:250], # Limit to 250 characters
18
  voice=voice_name,
19
+ model="eleven_multilingual_v2"
20
  )
21
  return (44100, np.frombuffer(pad_buffer(audio), dtype=np.int16))
22
  except UnauthenticatedRateLimitError as e:
 
46
  """
47
 
48
  description = """
49
+ A demo of the world's most advanced TTS systems, made by [ElevenLabs](https://elevenlabs.io). Eleven Multilingual v2 is a single foundational model supporting 28 languages languages including English, Chinese, Spanish, Hindi, Portuguese, French, German, Japanese, Arabic, Korean, Indonesian, Italian, Dutch, Turkish, Polish, Swedish, Filipino, Malay, Romanian, Ukrainian, Greek, Czech, Danish, Finnish, Bulgarian, Croatian, Slovak, and Tamil. Sign up on [ElevenLabs](https://elevenlabs.io) to get fast access, long-form generation, voice cloning, API keys, and more!
50
  """
51
 
52
  with gr.Blocks() as block:
53
+ gr.Markdown('[ ![ElevenLabs](https://user-images.githubusercontent.com/12028621/262629275-4f85c9cf-85b6-435e-ab50-5b8c7c4e9dd2.png) ](https://elevenlabs.io)')
54
  gr.Markdown(badges)
55
  gr.Markdown(description)
56
 
57
  input_text = gr.Textbox(
58
  label="Input Text (250 characters max)",
59
  lines=2,
60
+ value="Hello! 你好! Hola! नमस्ते! Olá! Bonjour! Hallo! こんにちは! مرحبا! 안녕하세요! Halo! Ciao! Hallo! Merhaba! Cześć! Hej! Kamusta! Halo! Bună! Привіт! Γειά σας! Ahoj! Hej! Hei! Здравей! Pozdrav! Ahoj! வணக்கம்!",
61
  elem_id="input_text"
62
  )
63
 
64
  all_voices = voices()
65
  input_voice = gr.Dropdown(
66
  [ voice.name for voice in all_voices ],
67
+ value="Bella",
68
  label="Voice",
69
  elem_id="input_voice"
70
  )
71
 
 
 
 
 
 
 
 
72
  run_button = gr.Button(
73
  text="Generate Voice",
74
  type="button"
 
80
  elem_id="out_audio"
81
  )
82
 
83
+ inputs = [input_text, input_voice]
84
  outputs = [out_audio]
85
 
86
  run_button.click(