PhilSpiel commited on
Commit
cf24a85
·
1 Parent(s): c3bbde6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -7
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  import requests
3
  import elevenlabs
4
  from elevenlabs import generate, play
@@ -7,6 +8,9 @@ import os
7
  # Define the password for access
8
  #password = os.getenv("PASSWORD") # Password to access app
9
 
 
 
 
10
  # Set the ElevenLabs API key using an environment variable
11
  elevenlabs.api_key = os.getenv("ELEVENLABS_API_KEY") # authenticate to use elevenlabs account
12
 
@@ -24,13 +28,18 @@ def generate_speech(text):
24
 
25
  # Data for the HTTP request, including the text to be converted, model_id, and voice settings
26
  data = {
27
- "text": text,
28
- "model_id": "eleven_multilingual_v2",
29
- "voice_settings": {
30
- "stability": 1.0,
31
- "similarity_boost": 1.0,
32
- "voice_id": "eIH76iW9yjOWnOKIkd6y"
33
- }
 
 
 
 
 
34
  }
35
 
36
  # Make a POST request to the specified URL with the provided data and headers,
 
1
  import gradio as gr
2
+ from openai import OpenAI
3
  import requests
4
  import elevenlabs
5
  from elevenlabs import generate, play
 
8
  # Define the password for access
9
  #password = os.getenv("PASSWORD") # Password to access app
10
 
11
+ # Set the OpenAI API key using an environment variable
12
+ elevenlabs.api_key = os.getenv("OPENAI_API_KEY") # authenticate to use elevenlabs account
13
+
14
  # Set the ElevenLabs API key using an environment variable
15
  elevenlabs.api_key = os.getenv("ELEVENLABS_API_KEY") # authenticate to use elevenlabs account
16
 
 
28
 
29
  # Data for the HTTP request, including the text to be converted, model_id, and voice settings
30
  data = {
31
+ "text": input_text,
32
+ "model_id": "eleven_multilingual_v2",
33
+ "voice_settings": {
34
+ "stability": 1.0,
35
+ "similarity_boost": 1.0,
36
+ "excitement": 0.9,
37
+ "speed": 1.1,
38
+ "volume": 80,
39
+ "pitch": 2.0,
40
+ "breathiness": 0.8,
41
+ "voice_id": "eIH76iW9yjOWnOKIkd6y"
42
+ }
43
  }
44
 
45
  # Make a POST request to the specified URL with the provided data and headers,