PhilSpiel commited on
Commit
e26210c
·
1 Parent(s): a1fc44b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -36,17 +36,27 @@ def generate_speech(input_text):
36
  "Content-Type": "application/json"
37
  }
38
  data = {
39
- "text": text_to_speech,
40
- # ... Other settings you provided
41
- }
 
 
 
 
 
 
 
 
 
 
42
  response = requests.post(url, json=data, headers=headers)
43
 
44
- # Return the response content directly if successful, otherwise raise an exception
45
  if response.status_code == 200:
46
  return response.content
47
  else:
48
- print("Error with ElevenLabs API:", response.text)
49
- raise Exception("Failed to generate speech")
50
 
51
  # Define the Gradio interface
52
  iface = gr.Interface(
 
36
  "Content-Type": "application/json"
37
  }
38
  data = {
39
+ "text": input_text,
40
+ "model_id": "eleven_multilingual_v2",
41
+ "voice_settings": {
42
+ "stability": 1.0,
43
+ "similarity_boost": 1.0,
44
+ "excitement": 0.9,
45
+ "speed": 1.1,
46
+ "volume": 80,
47
+ "pitch": 2.0,
48
+ "breathiness": 0.8,
49
+ "voice_id": "eIH76iW9yjOWnOKIkd6y"
50
+ }
51
+ }
52
  response = requests.post(url, json=data, headers=headers)
53
 
54
+ # Return the response content directly if successful, otherwise print error details
55
  if response.status_code == 200:
56
  return response.content
57
  else:
58
+ print("Error with ElevenLabs API:", response.status_code, response.text)
59
+ raise Exception(f"Failed to generate speech, status code: {response.status_code}, response: {response.text}")
60
 
61
  # Define the Gradio interface
62
  iface = gr.Interface(