Spaces:
Sleeping
Sleeping
mmccanse
commited on
Commit
·
e2672e3
1
Parent(s):
cb64706
update functions file to include AWS variable definitions.
Browse files- app.py +1 -0
- functions_mm.py +11 -1
app.py
CHANGED
|
@@ -27,6 +27,7 @@ import re
|
|
| 27 |
import boto3
|
| 28 |
|
| 29 |
|
|
|
|
| 30 |
# In[3]:
|
| 31 |
|
| 32 |
|
|
|
|
| 27 |
import boto3
|
| 28 |
|
| 29 |
|
| 30 |
+
|
| 31 |
# In[3]:
|
| 32 |
|
| 33 |
|
functions_mm.py
CHANGED
|
@@ -26,6 +26,11 @@ OPENAI_MODEL = "gpt-3.5-turbo"
|
|
| 26 |
# Store the API key in a variable.
|
| 27 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
#Define language variables ###################################################################################
|
| 30 |
|
| 31 |
#Define voice map
|
|
@@ -172,7 +177,12 @@ def transcribe_audio_original(audio_filepath):
|
|
| 172 |
|
| 173 |
|
| 174 |
#Initialize Polly client at module level
|
| 175 |
-
polly_client = boto3.client(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
# Define text-to-speech function using Amazon Polly
|
| 178 |
def polly_text_to_speech(text, lang_code):
|
|
|
|
| 26 |
# Store the API key in a variable.
|
| 27 |
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 28 |
|
| 29 |
+
#Define variables for AWS Polly Access#############################################################
|
| 30 |
+
aws_access_key_id = os.getenv('AWS_ACCESS_KEY_ID')
|
| 31 |
+
aws_secret_access_key = os.getenv('AWS_SECRET_ACCESS_KEY')
|
| 32 |
+
aws_default_region = os.getenv('AWS_DEFAULT_REGION')
|
| 33 |
+
|
| 34 |
#Define language variables ###################################################################################
|
| 35 |
|
| 36 |
#Define voice map
|
|
|
|
| 177 |
|
| 178 |
|
| 179 |
#Initialize Polly client at module level
|
| 180 |
+
polly_client = boto3.client(
|
| 181 |
+
'polly',
|
| 182 |
+
region_name=aws_default_region,
|
| 183 |
+
aws_access_key_id=aws_access_key_id,
|
| 184 |
+
aws_secret_access_key=aws_secret_access_key
|
| 185 |
+
)
|
| 186 |
|
| 187 |
# Define text-to-speech function using Amazon Polly
|
| 188 |
def polly_text_to_speech(text, lang_code):
|