luost26 commited on
Commit
35ba8d6
·
1 Parent(s): c3bc524
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -194,6 +194,9 @@ def main():
194
  )
195
 
196
  if uploaded_file is None:
 
 
 
197
  with st.expander("Don't know what to upload? Try these examples", expanded=True):
198
  with open('./data/examples/7DK2_AB_C.pdb', 'r') as f:
199
  st.download_button(
@@ -209,11 +212,6 @@ def main():
209
  )
210
  st.text('Please upload the downloaded PDB file to run the demo.')
211
 
212
- if 'submit' not in st.session_state:
213
- st.session_state.submit = False
214
- if 'done' not in st.session_state:
215
- st.session_state.done = False
216
-
217
  # Step 1.2: Retrieve uploaded PDB
218
  if uploaded_file is not None:
219
  pdb_path = os.path.join(tempdir_path, 'structure.pdb')
@@ -241,7 +239,8 @@ def main():
241
  if docking:
242
  st.warning('No antibodies detected. Will try to run docking (very slow).')
243
 
244
- form = st.form('design_form')
 
245
  with form:
246
  if H_chain is None and L_chain is None:
247
  # Antigen only
@@ -293,13 +292,26 @@ def main():
293
  if not GPU_AVAILABLE:
294
  st.warning('No GPU available. Sampling might be very slow.')
295
 
296
- submit = st.form_submit_button('Run')
 
297
  st.session_state.submit = st.session_state.submit or submit
298
  if submit:
299
  st.session_state.done = False
 
300
 
301
  # Step 3: Prepare configuration and run design
302
  if uploaded_file is not None and st.session_state.submit:
 
 
 
 
 
 
 
 
 
 
 
303
  config, config_path = get_config(
304
  save_dir = tempdir_path,
305
  mode = design_mode,
@@ -307,12 +319,6 @@ def main():
307
  num_samples = num_designs,
308
  )
309
 
310
- with right_col:
311
- result_molecule_display = st.empty()
312
- result_select_widget = st.empty()
313
- result_table_display = st.empty()
314
- result_download_btn = st.empty()
315
- output_display = st.empty()
316
  if not st.session_state.done:
317
  run_design(
318
  pdb_path = renum_path,
 
194
  )
195
 
196
  if uploaded_file is None:
197
+ st.session_state.submit = False
198
+ st.session_state.done = False
199
+
200
  with st.expander("Don't know what to upload? Try these examples", expanded=True):
201
  with open('./data/examples/7DK2_AB_C.pdb', 'r') as f:
202
  st.download_button(
 
212
  )
213
  st.text('Please upload the downloaded PDB file to run the demo.')
214
 
 
 
 
 
 
215
  # Step 1.2: Retrieve uploaded PDB
216
  if uploaded_file is not None:
217
  pdb_path = os.path.join(tempdir_path, 'structure.pdb')
 
239
  if docking:
240
  st.warning('No antibodies detected. Will try to run docking (very slow).')
241
 
242
+ # form = st.form('design_form')
243
+ form = st.container()
244
  with form:
245
  if H_chain is None and L_chain is None:
246
  # Antigen only
 
292
  if not GPU_AVAILABLE:
293
  st.warning('No GPU available. Sampling might be very slow.')
294
 
295
+ btn_placeholder = st.empty()
296
+ submit = btn_placeholder.button('Run', key="run_btn_real")
297
  st.session_state.submit = st.session_state.submit or submit
298
  if submit:
299
  st.session_state.done = False
300
+ btn_placeholder.empty()
301
 
302
  # Step 3: Prepare configuration and run design
303
  if uploaded_file is not None and st.session_state.submit:
304
+
305
+ with left_col:
306
+ output_display = st.empty()
307
+ output_display.code('[INFO] Your job has been submitted. Please wait...\n')
308
+
309
+ with right_col:
310
+ result_molecule_display = st.empty()
311
+ result_select_widget = st.empty()
312
+ result_table_display = st.empty()
313
+ result_download_btn = st.empty()
314
+
315
  config, config_path = get_config(
316
  save_dir = tempdir_path,
317
  mode = design_mode,
 
319
  num_samples = num_designs,
320
  )
321
 
 
 
 
 
 
 
322
  if not st.session_state.done:
323
  run_design(
324
  pdb_path = renum_path,