Kims12 commited on
Commit
951be8f
·
verified ·
1 Parent(s): c9d177d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -19,7 +19,10 @@ logger = logging.getLogger(__name__)
19
 
20
  # Gemini API 키 설정
21
  GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY", "")
22
- genai.configure(api_key=GEMINI_API_KEY)
 
 
 
23
 
24
  # 배경 JSON 파일 경로 설정 - 상대 경로 사용
25
  BACKGROUNDS_DIR = "./background"
@@ -107,7 +110,8 @@ def translate_prompt_to_english(prompt):
107
  prompt = prompt.replace("IMAGE_TAG_ONE", "#1")
108
  return prompt
109
 
110
- client = genai.Client(api_key=GEMINI_API_KEY)
 
111
  translation_prompt = f"""
112
  Translate the following Korean text to English:
113
 
 
19
 
20
  # Gemini API 키 설정
21
  GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY", "")
22
+
23
+ # API 키 설정 - 새로운 방식으로 수정
24
+ # genai.configure(api_key=GEMINI_API_KEY) 대신 클라이언트 객체를 생성
25
+ genai_client = genai.Client(api_key=GEMINI_API_KEY) if GEMINI_API_KEY else None
26
 
27
  # 배경 JSON 파일 경로 설정 - 상대 경로 사용
28
  BACKGROUNDS_DIR = "./background"
 
110
  prompt = prompt.replace("IMAGE_TAG_ONE", "#1")
111
  return prompt
112
 
113
+ # 기존: client = genai.Client(api_key=GEMINI_API_KEY)
114
+ client = genai_client # 전역 변수 사용
115
  translation_prompt = f"""
116
  Translate the following Korean text to English:
117