Update app.py
Browse files
app.py
CHANGED
|
@@ -27,9 +27,12 @@ from textblob import TextBlob
|
|
| 27 |
import whisper
|
| 28 |
import time
|
| 29 |
import os
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 33 |
|
| 34 |
def silence(duration, fps=44100):
|
| 35 |
"""
|
|
@@ -348,7 +351,7 @@ def generate_voiceover_OpenAI(translated_json, language, output_audio_path):
|
|
| 348 |
while retry_count < max_retries:
|
| 349 |
try:
|
| 350 |
# Create the speech using OpenAI TTS API
|
| 351 |
-
response =
|
| 352 |
model=model,
|
| 353 |
voice=voice,
|
| 354 |
input=full_text
|
|
|
|
| 27 |
import whisper
|
| 28 |
import time
|
| 29 |
import os
|
| 30 |
+
import openai
|
| 31 |
+
from openai import OpenAI
|
| 32 |
|
| 33 |
+
client = OpenAI(
|
| 34 |
+
api_key= os.environ.get("openAI_api_key"), # This is the default and can be omitted
|
| 35 |
+
)
|
| 36 |
|
| 37 |
def silence(duration, fps=44100):
|
| 38 |
"""
|
|
|
|
| 351 |
while retry_count < max_retries:
|
| 352 |
try:
|
| 353 |
# Create the speech using OpenAI TTS API
|
| 354 |
+
response = client.audio.speech.create(
|
| 355 |
model=model,
|
| 356 |
voice=voice,
|
| 357 |
input=full_text
|