reab5555 commited on
Commit
536f053
1 Parent(s): 71c000d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -15
app.py CHANGED
@@ -57,30 +57,20 @@ def launch_app():
57
  progress_bar = gr.Progress()
58
 
59
  with gr.Row():
60
- download_path = gr.State("")
61
- download_button = gr.Button("Download Cleaned CSV", visible=False)
62
 
63
  with gr.Row():
64
  output_gallery = gr.Gallery(label="Visualization Results", show_label=True, elem_id="gallery", columns=[2],
65
  rows=[2], object_fit="contain", height="auto")
66
 
67
- def process_and_prepare_download(file):
68
  cleaned_csv_path, image_files = clean_and_visualize(file, progress=progress_bar)
69
- return cleaned_csv_path, image_files, gr.Button(visible=True)
70
-
71
- def trigger_download(path):
72
- return gr.File.update(value=path, visible=True)
73
 
74
  clean_button.click(
75
- fn=process_and_prepare_download,
76
  inputs=file_input,
77
- outputs=[download_path, output_gallery, download_button]
78
- )
79
-
80
- download_button.click(
81
- fn=trigger_download,
82
- inputs=[download_path],
83
- outputs=[gr.File(label="Cleaned CSV", visible=False)]
84
  )
85
 
86
  app.launch()
 
57
  progress_bar = gr.Progress()
58
 
59
  with gr.Row():
60
+ cleaned_file_output = gr.File(label="Cleaned CSV", visible=False)
 
61
 
62
  with gr.Row():
63
  output_gallery = gr.Gallery(label="Visualization Results", show_label=True, elem_id="gallery", columns=[2],
64
  rows=[2], object_fit="contain", height="auto")
65
 
66
+ def process_and_show_results(file):
67
  cleaned_csv_path, image_files = clean_and_visualize(file, progress=progress_bar)
68
+ return cleaned_csv_path, image_files
 
 
 
69
 
70
  clean_button.click(
71
+ fn=process_and_show_results,
72
  inputs=file_input,
73
+ outputs=[cleaned_file_output, output_gallery]
 
 
 
 
 
 
74
  )
75
 
76
  app.launch()