Update app.py
Browse files
app.py
CHANGED
@@ -519,6 +519,30 @@ def create_app():
|
|
519 |
"์ํ ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ณ , ์ ํ๋ช
, ๋ฐฐ๊ฒฝ ์ต์
, ์ถ๊ฐ ์์ฒญ์ฌํญ์ ์
๋ ฅํ๋ฉด Gemini API๋ฅผ ํตํด ์์ด ํ๋กฌํํธ๋ฅผ ์์ฑํ๊ณ , ํด๋น ํ๋กฌํํธ๋ก ์ด๋ฏธ์ง๊ฐ ์์ฑ๋ฉ๋๋ค.\n\n"
|
520 |
"๋จ์ผ ์ด๋ฏธ์ง ์์ฑ๊ณผ 4์ฅ ์ด๋ฏธ์ง ์์ฑ ๋ชจ๋ ๊ฐ๋ฅํฉ๋๋ค."
|
521 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
with gr.Row():
|
523 |
with gr.Column(scale=1):
|
524 |
product_name = gr.Textbox(label="์ํ๋ช
(ํ๊ตญ์ด ์
๋ ฅ)", placeholder="์: ์คํจ์ผ์ด ํ๋ธ, ์ค๋งํธ์์น, ํฅ์, ์ด๋ํ ๋ฑ", interactive=True)
|
@@ -603,8 +627,7 @@ def create_app():
|
|
603 |
tech_dropdown: gr.update(visible=(bg_type == "ํ
ํฌ๋๋ก์ง ๋ฐฐ๊ฒฝ")),
|
604 |
colorful_dropdown: gr.update(visible=(bg_type == "์ปฌ๋ฌํ ํจํด ๋ฐฐ๊ฒฝ")),
|
605 |
abstract_dropdown: gr.update(visible=(bg_type == "์ถ์/ํน์ ๋ฐฐ๊ฒฝ")),
|
606 |
-
jewelry_dropdown: gr.update(visible=(bg_type == "์ฅฌ์ผ๋ฆฌ ๋ฐฐ๊ฒฝ"))
|
607 |
-
|
608 |
}
|
609 |
background_type.change(
|
610 |
fn=update_dropdowns,
|
|
|
519 |
"์ํ ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ณ , ์ ํ๋ช
, ๋ฐฐ๊ฒฝ ์ต์
, ์ถ๊ฐ ์์ฒญ์ฌํญ์ ์
๋ ฅํ๋ฉด Gemini API๋ฅผ ํตํด ์์ด ํ๋กฌํํธ๋ฅผ ์์ฑํ๊ณ , ํด๋น ํ๋กฌํํธ๋ก ์ด๋ฏธ์ง๊ฐ ์์ฑ๋ฉ๋๋ค.\n\n"
|
520 |
"๋จ์ผ ์ด๋ฏธ์ง ์์ฑ๊ณผ 4์ฅ ์ด๋ฏธ์ง ์์ฑ ๋ชจ๋ ๊ฐ๋ฅํฉ๋๋ค."
|
521 |
)
|
522 |
+
|
523 |
+
with gr.Row():
|
524 |
+
# API ํค ์
๋ ฅ ํ๋ ์ถ๊ฐ
|
525 |
+
gemini_api_key = gr.Textbox(
|
526 |
+
label="Gemini API ํค",
|
527 |
+
type="password",
|
528 |
+
placeholder="API ํค๋ฅผ ์
๋ ฅํ์ธ์",
|
529 |
+
interactive=True
|
530 |
+
)
|
531 |
+
|
532 |
+
# API ํค ์ค์ ๋ฒํผ ์ถ๊ฐ
|
533 |
+
api_key_btn = gr.Button("API ํค ์ค์ ")
|
534 |
+
api_key_status = gr.Textbox(label="API ํค ์ํ", interactive=False)
|
535 |
+
|
536 |
+
def set_api_key(api_key):
|
537 |
+
os.environ["GEMINI_API_KEY"] = api_key
|
538 |
+
return "API ํค๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์ค์ ๋์์ต๋๋ค."
|
539 |
+
|
540 |
+
api_key_btn.click(
|
541 |
+
fn=set_api_key,
|
542 |
+
inputs=[gemini_api_key],
|
543 |
+
outputs=[api_key_status]
|
544 |
+
)
|
545 |
+
|
546 |
with gr.Row():
|
547 |
with gr.Column(scale=1):
|
548 |
product_name = gr.Textbox(label="์ํ๋ช
(ํ๊ตญ์ด ์
๋ ฅ)", placeholder="์: ์คํจ์ผ์ด ํ๋ธ, ์ค๋งํธ์์น, ํฅ์, ์ด๋ํ ๋ฑ", interactive=True)
|
|
|
627 |
tech_dropdown: gr.update(visible=(bg_type == "ํ
ํฌ๋๋ก์ง ๋ฐฐ๊ฒฝ")),
|
628 |
colorful_dropdown: gr.update(visible=(bg_type == "์ปฌ๋ฌํ ํจํด ๋ฐฐ๊ฒฝ")),
|
629 |
abstract_dropdown: gr.update(visible=(bg_type == "์ถ์/ํน์ ๋ฐฐ๊ฒฝ")),
|
630 |
+
jewelry_dropdown: gr.update(visible=(bg_type == "์ฅฌ์ผ๋ฆฌ ๋ฐฐ๊ฒฝ"))
|
|
|
631 |
}
|
632 |
background_type.change(
|
633 |
fn=update_dropdowns,
|