Update app.py
Browse files
app.py
CHANGED
|
@@ -195,14 +195,19 @@ def show_results_tab(df):
|
|
| 195 |
interactive=True,
|
| 196 |
)
|
| 197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
with gr.Column():
|
| 199 |
table = gr.DataFrame(
|
| 200 |
value=df,
|
| 201 |
interactive=False,
|
| 202 |
wrap=False,
|
| 203 |
column_widths=calculate_column_widths(df),
|
| 204 |
-
show_copy_button=True
|
| 205 |
)
|
|
|
|
| 206 |
|
| 207 |
|
| 208 |
model_name.submit(
|
|
@@ -221,6 +226,11 @@ def show_results_tab(df):
|
|
| 221 |
outputs=table,
|
| 222 |
)
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
with gr.Row():
|
| 226 |
with gr.Accordion("Storage of Model Predictions", open=True):
|
|
|
|
| 195 |
interactive=True,
|
| 196 |
)
|
| 197 |
|
| 198 |
+
with gr.Row():
|
| 199 |
+
btn = gr.Button(value="生成表格", interactive=True)
|
| 200 |
+
|
| 201 |
+
download_btn = gr.File(visible=True)
|
| 202 |
+
|
| 203 |
with gr.Column():
|
| 204 |
table = gr.DataFrame(
|
| 205 |
value=df,
|
| 206 |
interactive=False,
|
| 207 |
wrap=False,
|
| 208 |
column_widths=calculate_column_widths(df),
|
|
|
|
| 209 |
)
|
| 210 |
+
download_btn = gr.File(visible=False)
|
| 211 |
|
| 212 |
|
| 213 |
model_name.submit(
|
|
|
|
| 226 |
outputs=table,
|
| 227 |
)
|
| 228 |
|
| 229 |
+
def download_table(df):
|
| 230 |
+
return df, gr.File(value=df.to_csv(index=False), visible=True)
|
| 231 |
+
|
| 232 |
+
btn.click(fn=download_table, inputs=df, outputs=[table, download_btn]
|
| 233 |
+
|
| 234 |
|
| 235 |
with gr.Row():
|
| 236 |
with gr.Accordion("Storage of Model Predictions", open=True):
|