aiqtech commited on
Commit
86348fd
·
verified ·
1 Parent(s): d938b4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -1101,9 +1101,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
1101
  with gr.Column(scale=1):
1102
  with gr.Group(elem_classes="input-panel"):
1103
  with gr.Tabs(elem_classes="tabs-container") as tabs:
1104
- with gr.TabItem("Image Upload & Inpainting", elem_classes="tab-item"):
1105
-
1106
-
1107
  input_image = gr.Image(
1108
  type="pil",
1109
  label="Upload Image",
@@ -1124,8 +1123,9 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
1124
  inpaint_btn = gr.Button("Apply Inpainting", variant="primary")
1125
 
1126
  # 두 번째 탭: 배경 제거 및 생성
 
 
1127
 
1128
- with gr.TabItem("Background Removal", elem_classes="tab-item"):
1129
  text_prompt = gr.Textbox(
1130
  label="Object to Extract",
1131
  placeholder="Enter what you want to extract...",
@@ -1305,11 +1305,12 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
1305
  )
1306
 
1307
  def handle_button_click(btn_pos):
 
1308
  print(f"Button clicked: {btn_pos}")
1309
- updates = {btn: gr.update(variant="secondary") for btn in position_mapping.keys()}
1310
- updates[btn_pos] = gr.update(variant="primary")
1311
  return [btn_pos] + [updates[btn] for btn in position_mapping.keys()]
1312
-
1313
  # 버튼 이벤트 바인딩
1314
  for btn, pos in position_mapping.items():
1315
  btn.click(
@@ -1319,6 +1320,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
1319
  api_name=f"btn_click_{pos}"
1320
  )
1321
 
 
1322
 
1323
  inpaint_btn.click(
1324
  fn=process_inpainting_with_feedback,
 
1101
  with gr.Column(scale=1):
1102
  with gr.Group(elem_classes="input-panel"):
1103
  with gr.Tabs(elem_classes="tabs-container") as tabs:
1104
+ with gr.Tab("Image Upload & Inpainting", elem_classes="tab-item"):
1105
+
 
1106
  input_image = gr.Image(
1107
  type="pil",
1108
  label="Upload Image",
 
1123
  inpaint_btn = gr.Button("Apply Inpainting", variant="primary")
1124
 
1125
  # 두 번째 탭: 배경 제거 및 생성
1126
+ with gr.Tab("Background Removal", elem_classes="tab-item"):
1127
+
1128
 
 
1129
  text_prompt = gr.Textbox(
1130
  label="Object to Extract",
1131
  placeholder="Enter what you want to extract...",
 
1305
  )
1306
 
1307
  def handle_button_click(btn_pos):
1308
+ """버튼 클릭 이벤트 핸들러"""
1309
  print(f"Button clicked: {btn_pos}")
1310
+ updates = {btn: gr.update(variant="secondary", value="") for btn in position_mapping.keys()}
1311
+ updates[btn_pos] = gr.update(variant="primary", value="selected")
1312
  return [btn_pos] + [updates[btn] for btn in position_mapping.keys()]
1313
+
1314
  # 버튼 이벤트 바인딩
1315
  for btn, pos in position_mapping.items():
1316
  btn.click(
 
1320
  api_name=f"btn_click_{pos}"
1321
  )
1322
 
1323
+
1324
 
1325
  inpaint_btn.click(
1326
  fn=process_inpainting_with_feedback,