Spaces:
Sleeping
Sleeping
Afrinetwork7
commited on
Commit
•
a921671
1
Parent(s):
efc7284
Update app.py
Browse files
app.py
CHANGED
@@ -159,18 +159,18 @@ async def synthesize_speech(request: TTSRequest):
|
|
159 |
# Generate a unique filename
|
160 |
filename = f"synthesized_audio_{int(time.time())}.wav"
|
161 |
|
162 |
-
# Upload to S3
|
163 |
try:
|
164 |
s3_client.upload_fileobj(
|
165 |
buffer,
|
166 |
S3_BUCKET,
|
167 |
filename,
|
168 |
-
ExtraArgs={'
|
169 |
)
|
170 |
logger.info(f"File uploaded successfully to S3: {filename}")
|
171 |
|
172 |
# Generate the public URL
|
173 |
-
url = f"https://
|
174 |
logger.info(f"Public URL generated: {url}")
|
175 |
|
176 |
return JSONResponse(content={"audio_url": url})
|
|
|
159 |
# Generate a unique filename
|
160 |
filename = f"synthesized_audio_{int(time.time())}.wav"
|
161 |
|
162 |
+
# Upload to S3 without ACL
|
163 |
try:
|
164 |
s3_client.upload_fileobj(
|
165 |
buffer,
|
166 |
S3_BUCKET,
|
167 |
filename,
|
168 |
+
ExtraArgs={'ContentType': 'audio/wav'}
|
169 |
)
|
170 |
logger.info(f"File uploaded successfully to S3: {filename}")
|
171 |
|
172 |
# Generate the public URL
|
173 |
+
url = f"https://s3.{S3_REGION}.amazonaws.com/{S3_BUCKET}/{s3_file}"
|
174 |
logger.info(f"Public URL generated: {url}")
|
175 |
|
176 |
return JSONResponse(content={"audio_url": url})
|