Modif fonction
Browse files- app.py +5 -6
- modal_app.py +1 -2
app.py
CHANGED
|
@@ -13,11 +13,8 @@ from modal_app import app, chai1_inference, download_inference_dependencies, her
|
|
| 13 |
|
| 14 |
# Function to compute Chai1 inference
|
| 15 |
def compute_Chai1(
|
| 16 |
-
force_redownload: bool = False,
|
| 17 |
fasta_file: Optional[str] = None,
|
| 18 |
inference_config_file: Optional[str] = None,
|
| 19 |
-
output_dir: Optional[str] = None,
|
| 20 |
-
run_id: Optional[str] = None,
|
| 21 |
):
|
| 22 |
"""Compute a Chai1 simulation.
|
| 23 |
|
|
@@ -29,6 +26,10 @@ def compute_Chai1(
|
|
| 29 |
"""
|
| 30 |
with app.run():
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
print("🧬 checking inference dependencies")
|
| 33 |
download_inference_dependencies.remote(force=force_redownload)
|
| 34 |
|
|
@@ -54,7 +55,6 @@ def compute_Chai1(
|
|
| 54 |
|
| 55 |
print(f"🧬 saving results to disk locally in {output_dir}")
|
| 56 |
for ii, (scores, cif) in enumerate(results):
|
| 57 |
-
print(ii, scores)
|
| 58 |
(Path(output_dir) / f"{run_id}-scores.model_idx_{ii}.npz").write_bytes(scores)
|
| 59 |
(Path(output_dir) / f"{run_id}-preds.model_idx_{ii}.cif").write_text(cif)
|
| 60 |
|
|
@@ -68,11 +68,10 @@ def compute_Chai1(
|
|
| 68 |
|
| 69 |
|
| 70 |
# Create the Gradio interface
|
| 71 |
-
|
| 72 |
reps = [{"model": 0,"style": "cartoon","color": "whiteCarbon"}]
|
| 73 |
|
| 74 |
with gr.Blocks() as demo:
|
| 75 |
-
inp = gr.Textbox(placeholder="Sequence file", label="Input Fasta file")
|
| 76 |
btn = gr.Button("Run")
|
| 77 |
out = Molecule3D(label="Molecule3D", reps=reps)
|
| 78 |
btn.click(fn=compute_Chai1, inputs=[inp], outputs=[out])
|
|
|
|
| 13 |
|
| 14 |
# Function to compute Chai1 inference
|
| 15 |
def compute_Chai1(
|
|
|
|
| 16 |
fasta_file: Optional[str] = None,
|
| 17 |
inference_config_file: Optional[str] = None,
|
|
|
|
|
|
|
| 18 |
):
|
| 19 |
"""Compute a Chai1 simulation.
|
| 20 |
|
|
|
|
| 26 |
"""
|
| 27 |
with app.run():
|
| 28 |
|
| 29 |
+
force_redownload = False
|
| 30 |
+
output_dir = None
|
| 31 |
+
run_id = None
|
| 32 |
+
|
| 33 |
print("🧬 checking inference dependencies")
|
| 34 |
download_inference_dependencies.remote(force=force_redownload)
|
| 35 |
|
|
|
|
| 55 |
|
| 56 |
print(f"🧬 saving results to disk locally in {output_dir}")
|
| 57 |
for ii, (scores, cif) in enumerate(results):
|
|
|
|
| 58 |
(Path(output_dir) / f"{run_id}-scores.model_idx_{ii}.npz").write_bytes(scores)
|
| 59 |
(Path(output_dir) / f"{run_id}-preds.model_idx_{ii}.cif").write_text(cif)
|
| 60 |
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
# Create the Gradio interface
|
|
|
|
| 71 |
reps = [{"model": 0,"style": "cartoon","color": "whiteCarbon"}]
|
| 72 |
|
| 73 |
with gr.Blocks() as demo:
|
| 74 |
+
inp = gr.Textbox(placeholder="Fasta Sequence file", label="Input Fasta file")
|
| 75 |
btn = gr.Button("Run")
|
| 76 |
out = Molecule3D(label="Molecule3D", reps=reps)
|
| 77 |
btn.click(fn=compute_Chai1, inputs=[inp], outputs=[out])
|
modal_app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
-
# Import
|
| 2 |
from pathlib import Path
|
| 3 |
-
|
| 4 |
import modal
|
| 5 |
|
| 6 |
# Define parameters for the Modal app
|
|
|
|
| 1 |
+
# Import libraries
|
| 2 |
from pathlib import Path
|
|
|
|
| 3 |
import modal
|
| 4 |
|
| 5 |
# Define parameters for the Modal app
|