reab5555 commited on
Commit
d7ffd4d
1 Parent(s): 807778a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -18
app.py CHANGED
@@ -45,7 +45,7 @@ def clean_and_visualize(file, progress=gr.Progress()):
45
 
46
  def launch_app():
47
  with gr.Blocks() as app:
48
- gr.Markdown("# Data Cleaning and Visualization App")
49
 
50
  with gr.Row():
51
  file_input = gr.File(label="Upload CSV File")
@@ -57,8 +57,7 @@ def launch_app():
57
  progress_bar = gr.Progress()
58
 
59
  with gr.Row():
60
- download_button = gr.Button("Download Cleaned CSV", visible=False)
61
- cleaned_file_output = gr.File(label="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],
@@ -66,25 +65,12 @@ def launch_app():
66
 
67
  def process_and_show_download(file):
68
  cleaned_csv_path, image_files = clean_and_visualize(file, progress=progress_bar)
69
- return (
70
- gr.Button.update(visible=True),
71
- gr.File.update(value=cleaned_csv_path, visible=True),
72
- image_files
73
- )
74
 
75
  clean_button.click(
76
  fn=process_and_show_download,
77
  inputs=file_input,
78
- outputs=[download_button, cleaned_file_output, output_gallery]
79
- )
80
-
81
- def trigger_download():
82
- return gr.File.update(visible=True)
83
-
84
- download_button.click(
85
- fn=trigger_download,
86
- inputs=[],
87
- outputs=[cleaned_file_output]
88
  )
89
 
90
  app.launch()
 
45
 
46
  def launch_app():
47
  with gr.Blocks() as app:
48
+ gr.Markdown("# AI Data Cleaner")
49
 
50
  with gr.Row():
51
  file_input = gr.File(label="Upload CSV File")
 
57
  progress_bar = gr.Progress()
58
 
59
  with gr.Row():
60
+ cleaned_file_output = gr.File(label="Download 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],
 
65
 
66
  def process_and_show_download(file):
67
  cleaned_csv_path, image_files = clean_and_visualize(file, progress=progress_bar)
68
+ return gr.File.update(value=cleaned_csv_path, visible=True), image_files
 
 
 
 
69
 
70
  clean_button.click(
71
  fn=process_and_show_download,
72
  inputs=file_input,
73
+ outputs=[cleaned_file_output, output_gallery]
 
 
 
 
 
 
 
 
 
74
  )
75
 
76
  app.launch()