Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,17 +69,17 @@ def generate_output(file, column1, column2, choice, bins):
|
|
69 |
plt.savefig(image_path)
|
70 |
# plt.close()
|
71 |
|
72 |
-
return df.head(), gr.update(visible=True), image_path, gr.update(visible=True)
|
73 |
|
74 |
with gr.Blocks() as demo:
|
75 |
with gr.Row():
|
76 |
with gr.Column():
|
77 |
file_input = gr.File(label="上传表格文件(支持CSV、XLS、XLSX等格式", file_types=["csv", "xls", "xlsx"])
|
78 |
-
col1_dropdown = gr.Dropdown(label="
|
79 |
-
col2_dropdown = gr.Dropdown(label="
|
80 |
-
choice_radio = gr.Radio(["是", "否"], label="
|
81 |
-
slider = gr.Slider(minimum=3, maximum=7, step=1, label="
|
82 |
-
submit_button = gr.Button("
|
83 |
with gr.Column():
|
84 |
df_display = gr.Dataframe(visible=False)
|
85 |
output_image = gr.Image(visible=False)
|
@@ -91,6 +91,6 @@ with gr.Blocks() as demo:
|
|
91 |
choice_radio.change(update_slider, inputs=choice_radio, outputs=slider)
|
92 |
|
93 |
# 点击提交按钮时调用 generate_output 函数
|
94 |
-
submit_button.click(generate_output, inputs=[file_input, col1_dropdown, col2_dropdown, choice_radio, slider], outputs=[df_display, df_display, output_image, output_image])
|
95 |
|
96 |
demo.launch(share=True)
|
|
|
69 |
plt.savefig(image_path)
|
70 |
# plt.close()
|
71 |
|
72 |
+
return df.head(), gr.update(visible=True), image_path, gr.update(visible=True), gr.update(visible=True)
|
73 |
|
74 |
with gr.Blocks() as demo:
|
75 |
with gr.Row():
|
76 |
with gr.Column():
|
77 |
file_input = gr.File(label="上传表格文件(支持CSV、XLS、XLSX等格式", file_types=["csv", "xls", "xlsx"])
|
78 |
+
col1_dropdown = gr.Dropdown(label="请选择特征列", visible=False)
|
79 |
+
col2_dropdown = gr.Dropdown(label="选择标签列", visible=False)
|
80 |
+
choice_radio = gr.Radio(["是", "否"], label="特征列是否为连续值", default="是", visible=False)
|
81 |
+
slider = gr.Slider(minimum=3, maximum=7, step=1, label="选择将特征列分组的分组数", visible=False, value=4)
|
82 |
+
submit_button = gr.Button("查看结果", visible=False)
|
83 |
with gr.Column():
|
84 |
df_display = gr.Dataframe(visible=False)
|
85 |
output_image = gr.Image(visible=False)
|
|
|
91 |
choice_radio.change(update_slider, inputs=choice_radio, outputs=slider)
|
92 |
|
93 |
# 点击提交按钮时调用 generate_output 函数
|
94 |
+
submit_button.click(generate_output, inputs=[file_input, col1_dropdown, col2_dropdown, choice_radio, slider], outputs=[df_display, df_display, output_image, output_image, submit_button])
|
95 |
|
96 |
demo.launch(share=True)
|