ssboost commited on
Commit
d62a2a1
Β·
verified Β·
1 Parent(s): f7d1828

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -35,6 +35,9 @@ def initialize_api_keys():
35
  key1 = os.environ.get("GEMINI_API_KEY_1", "")
36
  key2 = os.environ.get("GEMINI_API_KEY_2", "")
37
  key3 = os.environ.get("GEMINI_API_KEY_3", "")
 
 
 
38
 
39
  # 빈 λ¬Έμžμ—΄μ΄ μ•„λ‹Œ ν‚€λ§Œ μΆ”κ°€
40
  if key1:
@@ -43,6 +46,10 @@ def initialize_api_keys():
43
  API_KEYS.append(key2)
44
  if key3:
45
  API_KEYS.append(key3)
 
 
 
 
46
 
47
  # κΈ°μ‘΄ GEMINI_API_KEYκ°€ 있으면 μΆ”κ°€
48
  default_key = os.environ.get("GEMINI_API_KEY", "")
@@ -729,6 +736,8 @@ def generate_product_image(image, bg_type, simple, studio, nature, indoor, speci
729
  "1. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_1=\"your-api-key-1\"\n"
730
  "2. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_2=\"your-api-key-2\"\n"
731
  "3. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_3=\"your-api-key-3\"\n"
 
 
732
  "ν‚€ λ°œκΈ‰: https://aistudio.google.com/apikey"
733
  )
734
  return None, warning_msg, warning_msg
@@ -750,6 +759,8 @@ def generate_product_images(image, bg_type, simple, studio, nature, indoor, spec
750
  "1. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_1=\"your-api-key-1\"\n"
751
  "2. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_2=\"your-api-key-2\"\n"
752
  "3. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_3=\"your-api-key-3\"\n"
 
 
753
  "ν‚€ λ°œκΈ‰: https://aistudio.google.com/apikey"
754
  )
755
  return None, None, None, None, warning_msg, warning_msg
@@ -1074,7 +1085,7 @@ def create_app():
1074
  if actual_api_key:
1075
  os.environ["GEMINI_API_KEY"] = actual_api_key # ν™˜κ²½ λ³€μˆ˜ μ—…λ°μ΄νŠΈ
1076
  else:
1077
- return None, None, None, None, "API ν‚€κ°€ μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. ν™˜κ²½ λ³€μˆ˜μ— GEMINI_API_KEY_1, GEMINI_API_KEY_2, GEMINI_API_KEY_3 쀑 ν•˜λ‚˜ 이상을 μ„€μ •ν•΄μ£Όμ„Έμš”."
1078
  result_img, status, _ = generate_product_image(image, bg_type, simple, studio, nature, indoor, special, product_name, additional_info)
1079
  return result_img, None, None, None, status
1080
 
@@ -1091,7 +1102,7 @@ def create_app():
1091
  if actual_api_key:
1092
  os.environ["GEMINI_API_KEY"] = actual_api_key # ν™˜κ²½ λ³€μˆ˜ μ—…λ°μ΄νŠΈ
1093
  else:
1094
- return None, None, None, None, "API ν‚€κ°€ μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. ν™˜κ²½ λ³€μˆ˜μ— GEMINI_API_KEY_1, GEMINI_API_KEY_2, GEMINI_API_KEY_3 쀑 ν•˜λ‚˜ 이상을 μ„€μ •ν•΄μ£Όμ„Έμš”."
1095
 
1096
  img1, img2, img3, img4, combined_status, _ = generate_product_images(image, bg_type, simple, studio, nature, indoor, special, product_name, additional_info)
1097
 
 
35
  key1 = os.environ.get("GEMINI_API_KEY_1", "")
36
  key2 = os.environ.get("GEMINI_API_KEY_2", "")
37
  key3 = os.environ.get("GEMINI_API_KEY_3", "")
38
+ key4 = os.environ.get("GEMINI_API_KEY_4", "")
39
+ key5 = os.environ.get("GEMINI_API_KEY_5", "")
40
+
41
 
42
  # 빈 λ¬Έμžμ—΄μ΄ μ•„λ‹Œ ν‚€λ§Œ μΆ”κ°€
43
  if key1:
 
46
  API_KEYS.append(key2)
47
  if key3:
48
  API_KEYS.append(key3)
49
+ if key4:
50
+ API_KEYS.append(key4)
51
+ if key5:
52
+ API_KEYS.append(key5)
53
 
54
  # κΈ°μ‘΄ GEMINI_API_KEYκ°€ 있으면 μΆ”κ°€
55
  default_key = os.environ.get("GEMINI_API_KEY", "")
 
736
  "1. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_1=\"your-api-key-1\"\n"
737
  "2. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_2=\"your-api-key-2\"\n"
738
  "3. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_3=\"your-api-key-3\"\n"
739
+ "4. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_4=\"your-api-key-4\"\n"
740
+ "5. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_5=\"your-api-key-5\"\n"
741
  "ν‚€ λ°œκΈ‰: https://aistudio.google.com/apikey"
742
  )
743
  return None, warning_msg, warning_msg
 
759
  "1. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_1=\"your-api-key-1\"\n"
760
  "2. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_2=\"your-api-key-2\"\n"
761
  "3. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_3=\"your-api-key-3\"\n"
762
+ "4. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_4=\"your-api-key-4\"\n"
763
+ "5. ν™˜κ²½ λ³€μˆ˜: export GEMINI_API_KEY_5=\"your-api-key-5\"\n"
764
  "ν‚€ λ°œκΈ‰: https://aistudio.google.com/apikey"
765
  )
766
  return None, None, None, None, warning_msg, warning_msg
 
1085
  if actual_api_key:
1086
  os.environ["GEMINI_API_KEY"] = actual_api_key # ν™˜κ²½ λ³€μˆ˜ μ—…λ°μ΄νŠΈ
1087
  else:
1088
+ return None, None, None, None, "API ν‚€κ°€ μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. ν™˜κ²½ λ³€μˆ˜μ— GEMINI_API_KEY_1, GEMINI_API_KEY_2, GEMINI_API_KEY_3, GEMINI_API_KEY_4, GEMINI_API_KEY_5 쀑 ν•˜λ‚˜ 이상을 μ„€μ •ν•΄μ£Όμ„Έμš”."
1089
  result_img, status, _ = generate_product_image(image, bg_type, simple, studio, nature, indoor, special, product_name, additional_info)
1090
  return result_img, None, None, None, status
1091
 
 
1102
  if actual_api_key:
1103
  os.environ["GEMINI_API_KEY"] = actual_api_key # ν™˜κ²½ λ³€μˆ˜ μ—…λ°μ΄νŠΈ
1104
  else:
1105
+ return None, None, None, None, "API ν‚€κ°€ μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. ν™˜κ²½ λ³€μˆ˜μ— GEMINI_API_KEY_1, GEMINI_API_KEY_2, GEMINI_API_KEY_3, GEMINI_API_KEY_4, GEMINI_API_KEY_5 쀑 ν•˜λ‚˜ 이상을 μ„€μ •ν•΄μ£Όμ„Έμš”."
1106
 
1107
  img1, img2, img3, img4, combined_status, _ = generate_product_images(image, bg_type, simple, studio, nature, indoor, special, product_name, additional_info)
1108