suhyun1 commited on
Commit
012cadb
Β·
verified Β·
1 Parent(s): 7fc2f84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -7
app.py CHANGED
@@ -263,13 +263,28 @@ with gr.Blocks() as demo:
263
  """
264
  )
265
 
266
- keyword_path_display = gr.Textbox(label="ν˜„μž¬ ν‚€μ›Œλ“œ 경둜", interactive=False)
267
- keyword_selector = gr.Radio(choices=get_keywords([]), label="ν‚€μ›Œλ“œ 선택", value=None)
268
 
269
- keyword_selector.change(
270
- fn=on_keyword_select,
271
- inputs=[keyword_selector, path_state],
272
- outputs=[keyword_path_display, path_state, keyword_selector]
273
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
 
275
  demo.launch()
 
263
  """
264
  )
265
 
266
+ keyword_path_display = gr.Textbox(label="ν˜„μž¬ ν‚€μ›Œλ“œ 경둜", interactive=False)
267
+ keyword_selector = gr.Radio(choices=get_keywords([]), label="ν‚€μ›Œλ“œ 선택", value=None)
268
 
269
+ keyword_selector.change(
270
+ fn=on_keyword_select,
271
+ inputs=[keyword_selector, path_state],
272
+ outputs=[keyword_path_display, path_state, keyword_selector]
273
+ )
274
+
275
+ # λ’€λ‘œκ°€κΈ° λ²„νŠΌ μΆ”κ°€
276
+ def on_back_click(path):
277
+ if path:
278
+ path = path[:-1]
279
+ next_keywords = get_keywords(path)
280
+ formatted = format_path(path)
281
+ return formatted, path, gr.update(choices=next_keywords)
282
+
283
+ back_btn = gr.Button("πŸ”™ ν•œ 단계 λ’€λ‘œκ°€κΈ°")
284
+ back_btn.click(
285
+ fn=on_back_click,
286
+ inputs=[path_state],
287
+ outputs=[keyword_path_display, path_state, keyword_selector]
288
+ )
289
 
290
  demo.launch()