Spaces:
Runtime error
Runtime error
Update openai_tts_tool.py
Browse files- openai_tts_tool.py +2 -2
openai_tts_tool.py
CHANGED
@@ -4,7 +4,7 @@ import os
|
|
4 |
from langdetect import detect, DetectorFactory
|
5 |
import logging
|
6 |
from openai import OpenAI
|
7 |
-
|
8 |
|
9 |
# Ensure consistent results from langdetect
|
10 |
DetectorFactory.seed = 0
|
@@ -41,7 +41,7 @@ def translate_text(api_key, text, target_language, length=1000):
|
|
41 |
|
42 |
try:
|
43 |
logging.info("Starting translation process.")
|
44 |
-
|
45 |
# Ensure the client is initialized
|
46 |
if client is None:
|
47 |
logging.error("OpenAI client is not initialized.")
|
|
|
4 |
from langdetect import detect, DetectorFactory
|
5 |
import logging
|
6 |
from openai import OpenAI
|
7 |
+
|
8 |
|
9 |
# Ensure consistent results from langdetect
|
10 |
DetectorFactory.seed = 0
|
|
|
41 |
|
42 |
try:
|
43 |
logging.info("Starting translation process.")
|
44 |
+
client = OpenAI(api_key=api_key)
|
45 |
# Ensure the client is initialized
|
46 |
if client is None:
|
47 |
logging.error("OpenAI client is not initialized.")
|