Spaces:
Build error
Build error
Fix: Update app.py to resolve Internal Server Error
Browse files
app.py
CHANGED
|
@@ -304,8 +304,13 @@ def create_interface():
|
|
| 304 |
)
|
| 305 |
|
| 306 |
# Update export object dropdown when connection is made
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
connect_btn.click(
|
| 308 |
-
fn=
|
| 309 |
inputs=[connection_status, upload_tab, object_dropdown],
|
| 310 |
outputs=[export_object]
|
| 311 |
)
|
|
@@ -322,8 +327,11 @@ def create_interface():
|
|
| 322 |
outputs=[export_fields, export_fields_info]
|
| 323 |
)
|
| 324 |
|
|
|
|
|
|
|
|
|
|
| 325 |
operation_dropdown.change(
|
| 326 |
-
fn=
|
| 327 |
inputs=[operation_dropdown],
|
| 328 |
outputs=[external_id_field]
|
| 329 |
)
|
|
@@ -334,8 +342,11 @@ def create_interface():
|
|
| 334 |
outputs=[upload_results, download_results]
|
| 335 |
)
|
| 336 |
|
|
|
|
|
|
|
|
|
|
| 337 |
download_results.change(
|
| 338 |
-
fn=
|
| 339 |
inputs=[download_results],
|
| 340 |
outputs=[download_results]
|
| 341 |
)
|
|
@@ -346,8 +357,11 @@ def create_interface():
|
|
| 346 |
outputs=[export_results, download_export]
|
| 347 |
)
|
| 348 |
|
|
|
|
|
|
|
|
|
|
| 349 |
download_export.change(
|
| 350 |
-
fn=
|
| 351 |
inputs=[download_export],
|
| 352 |
outputs=[download_export]
|
| 353 |
)
|
|
|
|
| 304 |
)
|
| 305 |
|
| 306 |
# Update export object dropdown when connection is made
|
| 307 |
+
def update_export_dropdown(status, visible, choices):
|
| 308 |
+
if visible and choices:
|
| 309 |
+
return gr.update(choices=choices, value=None)
|
| 310 |
+
return gr.update(choices=[], value=None)
|
| 311 |
+
|
| 312 |
connect_btn.click(
|
| 313 |
+
fn=update_export_dropdown,
|
| 314 |
inputs=[connection_status, upload_tab, object_dropdown],
|
| 315 |
outputs=[export_object]
|
| 316 |
)
|
|
|
|
| 327 |
outputs=[export_fields, export_fields_info]
|
| 328 |
)
|
| 329 |
|
| 330 |
+
def toggle_external_id(operation):
|
| 331 |
+
return gr.update(visible=(operation == "Upsert"))
|
| 332 |
+
|
| 333 |
operation_dropdown.change(
|
| 334 |
+
fn=toggle_external_id,
|
| 335 |
inputs=[operation_dropdown],
|
| 336 |
outputs=[external_id_field]
|
| 337 |
)
|
|
|
|
| 342 |
outputs=[upload_results, download_results]
|
| 343 |
)
|
| 344 |
|
| 345 |
+
def show_download_results(file):
|
| 346 |
+
return gr.update(visible=file is not None)
|
| 347 |
+
|
| 348 |
download_results.change(
|
| 349 |
+
fn=show_download_results,
|
| 350 |
inputs=[download_results],
|
| 351 |
outputs=[download_results]
|
| 352 |
)
|
|
|
|
| 357 |
outputs=[export_results, download_export]
|
| 358 |
)
|
| 359 |
|
| 360 |
+
def show_download_export(file):
|
| 361 |
+
return gr.update(visible=file is not None)
|
| 362 |
+
|
| 363 |
download_export.change(
|
| 364 |
+
fn=show_download_export,
|
| 365 |
inputs=[download_export],
|
| 366 |
outputs=[download_export]
|
| 367 |
)
|