qqwjq1981 commited on
Commit
e106937
·
verified ·
1 Parent(s): f357832

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -27,9 +27,12 @@ from textblob import TextBlob
27
  import whisper
28
  import time
29
  import os
 
 
30
 
31
- # Set your OpenAI API key
32
- openai.api_key = os.environ['openAI_api_key']
 
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 = openai.Audio.speech.create(
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