gabboud commited on
Commit
1ec1069
·
1 Parent(s): 22a41b0

download results

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -54,6 +54,7 @@ with gr.Blocks(title="RFD3 Test") as demo:
54
  gen_directory = gr.State(None)
55
  gen_results = gr.State(None)
56
  gen_btn = gr.Button("Run Unconditional Generation")
 
57
 
58
 
59
  # Section to inspect PDB of generated structures
@@ -73,11 +74,21 @@ with gr.Blocks(title="RFD3 Test") as demo:
73
  display_state = gr.Textbox(label="Selected Batch and Design", visible=True)
74
  display_state.value = "Please Select a Batch and Design number to show sequence"
75
 
 
 
 
 
 
 
76
 
77
  gen_btn.click(unconditional_generation, inputs=[num_batches, num_designs_per_batch, length], outputs=[gen_directory, gen_results]).then(
78
  update_batch_choices,
79
  inputs=gen_results,
80
- outputs=batch_dropdown)
 
 
 
 
81
 
82
  batch_dropdown.change(update_designs, inputs=[batch_dropdown, gen_results], outputs=[design_dropdown])
83
  design_dropdown.change()
@@ -85,6 +96,9 @@ with gr.Blocks(title="RFD3 Test") as demo:
85
  show_pdb_btn.click(show_pdb, inputs=[batch_dropdown, design_dropdown, gen_results], outputs=display_state)
86
 
87
 
 
 
 
88
  #def load_viewer(batch, design, result):
89
  # if batch is None or design is None:
90
  # return gr.update()
 
54
  gen_directory = gr.State(None)
55
  gen_results = gr.State(None)
56
  gen_btn = gr.Button("Run Unconditional Generation")
57
+ output_file = gr.File(label="Download RFD3 results as zip", visible=True)
58
 
59
 
60
  # Section to inspect PDB of generated structures
 
74
  display_state = gr.Textbox(label="Selected Batch and Design", visible=True)
75
  display_state.value = "Please Select a Batch and Design number to show sequence"
76
 
77
+ def download_results_as_zip(directory):
78
+ if directory is None:
79
+ return gr.update()
80
+ zip_path = f"{directory}.zip"
81
+ shutil.make_archive(directory, 'zip', directory)
82
+ return gr.update(value=zip_path, visible=True)
83
 
84
  gen_btn.click(unconditional_generation, inputs=[num_batches, num_designs_per_batch, length], outputs=[gen_directory, gen_results]).then(
85
  update_batch_choices,
86
  inputs=gen_results,
87
+ outputs=batch_dropdown).then(
88
+ download_results_as_zip,
89
+ inputs=gen_directory,
90
+ outputs=output_file
91
+ )
92
 
93
  batch_dropdown.change(update_designs, inputs=[batch_dropdown, gen_results], outputs=[design_dropdown])
94
  design_dropdown.change()
 
96
  show_pdb_btn.click(show_pdb, inputs=[batch_dropdown, design_dropdown, gen_results], outputs=display_state)
97
 
98
 
99
+
100
+
101
+
102
  #def load_viewer(batch, design, result):
103
  # if batch is None or design is None:
104
  # return gr.update()