reab5555 commited on
Commit
856356f
1 Parent(s): d7ffd4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -45,10 +45,10 @@ def clean_and_visualize(file, progress=gr.Progress()):
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")
52
 
53
  with gr.Row():
54
  clean_button = gr.Button("Start Cleaning")
@@ -57,7 +57,7 @@ def launch_app():
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,12 +65,12 @@ def launch_app():
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()
 
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", file_count="single", file_types=[".csv"])
52
 
53
  with gr.Row():
54
  clean_button = gr.Button("Start Cleaning")
 
57
  progress_bar = gr.Progress()
58
 
59
  with gr.Row():
60
+ download_button = gr.DownloadButton(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.DownloadButton.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=[download_button, output_gallery]
74
  )
75
 
76
  app.launch()