Update app.py
Browse files
app.py
CHANGED
@@ -299,14 +299,14 @@ def create_gradio_interface():
|
|
299 |
info = gr.Textbox(label="์ฒ๋ฆฌ ์ ๋ณด", interactive=False)
|
300 |
error = gr.Textbox(label="์ค๋ฅ ๋ฉ์์ง", interactive=False, visible=True)
|
301 |
|
302 |
-
# ํ๋กฌํํธ๋ง ์์ฑํ๋ ํจ์ (
|
303 |
-
def
|
304 |
return api_generate_prompt_with_password_check(
|
305 |
password, bg_type, simple, studio, nature, indoor, special, jewelry, special_effects, request_text, aspect_ratio
|
306 |
)
|
307 |
|
308 |
-
# ์ด๋ฏธ์ง ์ฒ๋ฆฌ ํจ์ (
|
309 |
-
def
|
310 |
if image is None:
|
311 |
return [], None, [], None, "", "", "์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํด์ผ ํฉ๋๋ค."
|
312 |
|
@@ -330,9 +330,9 @@ def create_gradio_interface():
|
|
330 |
except:
|
331 |
pass
|
332 |
|
333 |
-
# ํ๋กฌํํธ ์์ฑ ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ
|
334 |
generate_prompt_btn.click(
|
335 |
-
fn=
|
336 |
inputs=[
|
337 |
password_box,
|
338 |
background_type,
|
@@ -340,12 +340,13 @@ def create_gradio_interface():
|
|
340 |
jewelry_dropdown, special_effects_dropdown,
|
341 |
request_text, aspect_ratio
|
342 |
],
|
343 |
-
outputs=[prompt_output]
|
|
|
344 |
)
|
345 |
|
346 |
-
# ํธ์ง ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ
|
347 |
edit_btn.click(
|
348 |
-
fn=
|
349 |
inputs=[
|
350 |
password_box,
|
351 |
image, background_type,
|
@@ -357,7 +358,8 @@ def create_gradio_interface():
|
|
357 |
original_output, original_download,
|
358 |
enhanced_output, enhanced_download,
|
359 |
prompt_output, info, error
|
360 |
-
]
|
|
|
361 |
)
|
362 |
|
363 |
logger.info("Gradio interface created successfully")
|
|
|
299 |
info = gr.Textbox(label="์ฒ๋ฆฌ ์ ๋ณด", interactive=False)
|
300 |
error = gr.Textbox(label="์ค๋ฅ ๋ฉ์์ง", interactive=False, visible=True)
|
301 |
|
302 |
+
# ํ๋กฌํํธ๋ง ์์ฑํ๋ ํจ์ (์๋ณธ๊ณผ ๋์ผํ ์๋ํฌ์ธํธ)
|
303 |
+
def generate_prompt_with_password_check(password, bg_type, simple, studio, nature, indoor, special, jewelry, special_effects, request_text, aspect_ratio):
|
304 |
return api_generate_prompt_with_password_check(
|
305 |
password, bg_type, simple, studio, nature, indoor, special, jewelry, special_effects, request_text, aspect_ratio
|
306 |
)
|
307 |
|
308 |
+
# ์ด๋ฏธ์ง ์ฒ๋ฆฌ ํจ์ (์๋ณธ๊ณผ ๋์ผํ ์๋ํฌ์ธํธ)
|
309 |
+
def check_password(password, image, bg_type, simple, studio, nature, indoor, special, jewelry, special_effects, request_text, quality_level, aspect_ratio, output_format, enable_enhancement):
|
310 |
if image is None:
|
311 |
return [], None, [], None, "", "", "์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํด์ผ ํฉ๋๋ค."
|
312 |
|
|
|
330 |
except:
|
331 |
pass
|
332 |
|
333 |
+
# ํ๋กฌํํธ ์์ฑ ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ (์๋ณธ๊ณผ ๋์ผํ API ์ด๋ฆ)
|
334 |
generate_prompt_btn.click(
|
335 |
+
fn=generate_prompt_with_password_check,
|
336 |
inputs=[
|
337 |
password_box,
|
338 |
background_type,
|
|
|
340 |
jewelry_dropdown, special_effects_dropdown,
|
341 |
request_text, aspect_ratio
|
342 |
],
|
343 |
+
outputs=[prompt_output],
|
344 |
+
api_name="generate_prompt_with_password_check" # ์๋ณธ๊ณผ ๋์ผํ API ์ด๋ฆ
|
345 |
)
|
346 |
|
347 |
+
# ํธ์ง ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ (์๋ณธ๊ณผ ๋์ผํ API ์ด๋ฆ)
|
348 |
edit_btn.click(
|
349 |
+
fn=check_password,
|
350 |
inputs=[
|
351 |
password_box,
|
352 |
image, background_type,
|
|
|
358 |
original_output, original_download,
|
359 |
enhanced_output, enhanced_download,
|
360 |
prompt_output, info, error
|
361 |
+
],
|
362 |
+
api_name="check_password" # ์๋ณธ๊ณผ ๋์ผํ API ์ด๋ฆ
|
363 |
)
|
364 |
|
365 |
logger.info("Gradio interface created successfully")
|