ssboost commited on
Commit
b2ce728
ยท
verified ยท
1 Parent(s): d8e2aec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
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
- # ํ”„๋กฌํ”„ํŠธ๋งŒ ์ƒ์„ฑํ•˜๋Š” ํ•จ์ˆ˜ (API ํ˜ธ์ถœ)
303
- def generate_prompt_wrapper(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
- # ์ด๋ฏธ์ง€ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜ (API ํ˜ธ์ถœ)
309
- def process_image_wrapper(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,9 +330,9 @@ def create_gradio_interface():
330
  except:
331
  pass
332
 
333
- # ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ ๋ฒ„ํŠผ ํด๋ฆญ ์ด๋ฒคํŠธ
334
  generate_prompt_btn.click(
335
- fn=generate_prompt_wrapper,
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=process_image_wrapper,
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")