soojeongcrystal commited on
Commit
1e47f6f
·
verified ·
1 Parent(s): 34caa4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -133,6 +133,11 @@ def perform_clustering(df, features):
133
 
134
  return result_text, fig, elbow_fig
135
 
 
 
 
 
 
136
  # Gradio 인터페이스 설정
137
  with gr.Blocks() as demo:
138
  gr.Markdown("# 고급 한국어 데이터 분석 앱")
@@ -158,13 +163,10 @@ with gr.Blocks() as demo:
158
 
159
  df = gr.State()
160
 
161
- def update_variable_options(df):
162
- if df is not None:
163
- return gr.Dropdown.update(choices=df.columns), gr.Dropdown.update(choices=df.columns)
164
- return gr.Dropdown.update(choices=[]), gr.Dropdown.update(choices=[])
165
 
166
- upload_button.click(process_file, inputs=file_input, outputs=[df, upload_output])
167
- df.change(update_variable_options, inputs=[df], outputs=[target_variable, feature_variables])
168
  analyze_button.click(
169
  analyze_data,
170
  inputs=[df, query_input, target_variable, feature_variables],
 
133
 
134
  return result_text, fig, elbow_fig
135
 
136
+ def update_variable_options(df):
137
+ if df is not None:
138
+ return gr.Dropdown.update(choices=df.columns), gr.Dropdown.update(choices=df.columns)
139
+ return gr.Dropdown.update(choices=[]), gr.Dropdown.update(choices=[])
140
+
141
  # Gradio 인터페이스 설정
142
  with gr.Blocks() as demo:
143
  gr.Markdown("# 고급 한국어 데이터 분석 앱")
 
163
 
164
  df = gr.State()
165
 
166
+ upload_button.click(process_file, inputs=file_input, outputs=[df, upload_output]).then(
167
+ update_variable_options, inputs=[df], outputs=[target_variable, feature_variables]
168
+ )
 
169
 
 
 
170
  analyze_button.click(
171
  analyze_data,
172
  inputs=[df, query_input, target_variable, feature_variables],