Update app.py
Browse files
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 |
|