jonathanjordan21 commited on
Commit
4510b89
·
verified ·
1 Parent(s): 20511e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -20,9 +20,12 @@ def process_inputs(user_input_json, session_id_json, project_id_json, chat_url,
20
  "output_variables": output_vars
21
  })
22
 
 
 
 
23
  csv_path = "output.csv"
24
  df.to_csv(csv_path, index=False)
25
- return df, csv_path
26
 
27
 
28
  with gr.Blocks() as demo:
@@ -37,13 +40,22 @@ with gr.Blocks() as demo:
37
 
38
  run_btn = gr.Button("Run Function")
39
 
40
- df_output = gr.Dataframe(label="Output DataFrame", interactive=False)
 
 
 
41
  file_output = gr.File(label="Download CSV")
42
 
 
 
 
 
 
 
43
  run_btn.click(
44
  fn=process_inputs,
45
  inputs=[user_input, session_id, project_id, chat_url, update_vars, output_vars],
46
- outputs=[df_output, file_output]
47
  )
48
 
49
  demo.launch()
 
20
  "output_variables": output_vars
21
  })
22
 
23
+ return df
24
+
25
+ def run_process(df):
26
  csv_path = "output.csv"
27
  df.to_csv(csv_path, index=False)
28
+ return csv_path
29
 
30
 
31
  with gr.Blocks() as demo:
 
40
 
41
  run_btn = gr.Button("Run Function")
42
 
43
+ df_output = gr.Dataframe(label="Output DataFrame", interactive=True)
44
+
45
+ process_btn = gr.Button("Process")
46
+
47
  file_output = gr.File(label="Download CSV")
48
 
49
+ process_btn.click(
50
+ fn=run_process,
51
+ inputs=df_output
52
+ outputs=file_output
53
+ )
54
+
55
  run_btn.click(
56
  fn=process_inputs,
57
  inputs=[user_input, session_id, project_id, chat_url, update_vars, output_vars],
58
+ outputs=df_output
59
  )
60
 
61
  demo.launch()