Spaces:
Running on Zero
Running on Zero
fix nested list error in gradio click function
Browse files- app.py +3 -2
- utils/handle_events.py +2 -2
- utils/handle_files.py +0 -0
- utils/pipelines.py +1 -0
app.py
CHANGED
|
@@ -12,6 +12,7 @@ from utils.download_weights import download_weights
|
|
| 12 |
from utils.pipelines import test_rfd3_from_notebook, unconditional_generation
|
| 13 |
#from gradio_molecule3d import Molecule3D
|
| 14 |
from utils.handle_events import *
|
|
|
|
| 15 |
|
| 16 |
download_weights()
|
| 17 |
|
|
@@ -78,7 +79,7 @@ with gr.Blocks(title="RFD3 Test") as demo:
|
|
| 78 |
config_textbox = gr.Textbox(value ="Waiting for config validation...")
|
| 79 |
|
| 80 |
with gr.Column(scale=1): # Right half
|
| 81 |
-
gr.Markdown("Upload your target/scaffold structure as a PDB file to condition the generation. Press
|
| 82 |
with gr.Tabs():
|
| 83 |
with gr.TabItem("Scaffold PDB"):
|
| 84 |
scaffold_upload = gr.File(label="Target/Scaffold PDB", file_types=[".pdb"])
|
|
@@ -95,7 +96,7 @@ with gr.Blocks(title="RFD3 Test") as demo:
|
|
| 95 |
manual_tab.select(lambda: "manual", outputs=tab_selected)
|
| 96 |
|
| 97 |
# validate the configuration
|
| 98 |
-
config_validation_btn.click(validate_config_ready, inputs=[tab_selected, config_upload,
|
| 99 |
scaffold_validation_btn.click(validate_scaffold_ready_with_file, inputs=scaffold_upload, outputs=[scaffold_textbox, scaffold_ready])
|
| 100 |
no_input_btn.click(lambda: ("No scaffold/target will be used. Ready for unconditional generation!", "no_input"), outputs=[scaffold_textbox, scaffold_ready])
|
| 101 |
|
|
|
|
| 12 |
from utils.pipelines import test_rfd3_from_notebook, unconditional_generation
|
| 13 |
#from gradio_molecule3d import Molecule3D
|
| 14 |
from utils.handle_events import *
|
| 15 |
+
from utils.handle_files import *
|
| 16 |
|
| 17 |
download_weights()
|
| 18 |
|
|
|
|
| 79 |
config_textbox = gr.Textbox(value ="Waiting for config validation...")
|
| 80 |
|
| 81 |
with gr.Column(scale=1): # Right half
|
| 82 |
+
gr.Markdown("Upload your target/scaffold structure as a PDB file to condition the generation. Press 'No Scaffold/Target' if you want to run an unconditional generation.")
|
| 83 |
with gr.Tabs():
|
| 84 |
with gr.TabItem("Scaffold PDB"):
|
| 85 |
scaffold_upload = gr.File(label="Target/Scaffold PDB", file_types=[".pdb"])
|
|
|
|
| 96 |
manual_tab.select(lambda: "manual", outputs=tab_selected)
|
| 97 |
|
| 98 |
# validate the configuration
|
| 99 |
+
config_validation_btn.click(validate_config_ready, inputs=[tab_selected, config_upload, num_designs_per_batch, num_batches, length], outputs=[config_textbox, config_ready])
|
| 100 |
scaffold_validation_btn.click(validate_scaffold_ready_with_file, inputs=scaffold_upload, outputs=[scaffold_textbox, scaffold_ready])
|
| 101 |
no_input_btn.click(lambda: ("No scaffold/target will be used. Ready for unconditional generation!", "no_input"), outputs=[scaffold_textbox, scaffold_ready])
|
| 102 |
|
utils/handle_events.py
CHANGED
|
@@ -57,7 +57,7 @@ def show_pdb(batch, design, result):
|
|
| 57 |
print(pdb_str)
|
| 58 |
return gr.update(value=f"Selected Batch: {batch}, Design: {design}, saved at {pdb_path}:\n {pdb_str}", visible=True)
|
| 59 |
|
| 60 |
-
def validate_config_ready(tab_selected, config_upload,
|
| 61 |
"""
|
| 62 |
Once the user presses on the Validate Config button, this function checks whether the config is really ready to go.
|
| 63 |
It is ready, either if the user has selected the manual config tab, or if they have uploaded a config file in the upload config tab and have it open.
|
|
@@ -78,7 +78,7 @@ def validate_config_ready(tab_selected, config_upload, numbers):
|
|
| 78 |
"""
|
| 79 |
|
| 80 |
if tab_selected == "manual":
|
| 81 |
-
for num in
|
| 82 |
if num is None:
|
| 83 |
return "Please fill in all the parameters for manual config to be ready for generation.", None
|
| 84 |
return "Manual parameters selected and valid!", "manual"
|
|
|
|
| 57 |
print(pdb_str)
|
| 58 |
return gr.update(value=f"Selected Batch: {batch}, Design: {design}, saved at {pdb_path}:\n {pdb_str}", visible=True)
|
| 59 |
|
| 60 |
+
def validate_config_ready(tab_selected, config_upload, num_designs_per_batch, num_batches, length):
|
| 61 |
"""
|
| 62 |
Once the user presses on the Validate Config button, this function checks whether the config is really ready to go.
|
| 63 |
It is ready, either if the user has selected the manual config tab, or if they have uploaded a config file in the upload config tab and have it open.
|
|
|
|
| 78 |
"""
|
| 79 |
|
| 80 |
if tab_selected == "manual":
|
| 81 |
+
for num in [num_designs_per_batch, num_batches, length]:
|
| 82 |
if num is None:
|
| 83 |
return "Please fill in all the parameters for manual config to be ready for generation.", None
|
| 84 |
return "Manual parameters selected and valid!", "manual"
|
utils/handle_files.py
ADDED
|
File without changes
|
utils/pipelines.py
CHANGED
|
@@ -7,6 +7,7 @@ import spaces
|
|
| 7 |
import subprocess
|
| 8 |
import gzip
|
| 9 |
import gemmi
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
|
|
|
|
| 7 |
import subprocess
|
| 8 |
import gzip
|
| 9 |
import gemmi
|
| 10 |
+
from utils.handle_files import *
|
| 11 |
|
| 12 |
|
| 13 |
|