Spaces:
Running on Zero
Running on Zero
fix event chain continuity so File component gives the filepath
Browse files- app.py +2 -2
- utils/pipelines.py +5 -7
app.py
CHANGED
|
@@ -120,7 +120,7 @@ with gr.Blocks(title="RFD3 Test") as demo:
|
|
| 120 |
display_state = gr.Textbox(label="Selected Batch and Design", visible=True)
|
| 121 |
display_state.value = "Please Select a Batch and Design number to show sequence"
|
| 122 |
|
| 123 |
-
def generate(config_ready, scaffold_ready, num_batches, num_designs_per_batch, length):
|
| 124 |
if config_ready is None or scaffold_ready is None:
|
| 125 |
return None, None
|
| 126 |
if config_ready == "upload" and scaffold_ready == "no_input":
|
|
@@ -131,7 +131,7 @@ with gr.Blocks(title="RFD3 Test") as demo:
|
|
| 131 |
return gen_directory, gen_results
|
| 132 |
|
| 133 |
run_btn.click(give_run_status, inputs=[config_ready, scaffold_ready, num_batches, num_designs_per_batch, length, config_upload], outputs=runtextbox).then(
|
| 134 |
-
generate, inputs=[config_ready, scaffold_ready, num_batches, num_designs_per_batch, length], outputs=[gen_directory, gen_results]
|
| 135 |
).then(
|
| 136 |
update_batch_choices,
|
| 137 |
inputs=gen_results,
|
|
|
|
| 120 |
display_state = gr.Textbox(label="Selected Batch and Design", visible=True)
|
| 121 |
display_state.value = "Please Select a Batch and Design number to show sequence"
|
| 122 |
|
| 123 |
+
def generate(config_ready, scaffold_ready, num_batches, num_designs_per_batch, length, config_upload):
|
| 124 |
if config_ready is None or scaffold_ready is None:
|
| 125 |
return None, None
|
| 126 |
if config_ready == "upload" and scaffold_ready == "no_input":
|
|
|
|
| 131 |
return gen_directory, gen_results
|
| 132 |
|
| 133 |
run_btn.click(give_run_status, inputs=[config_ready, scaffold_ready, num_batches, num_designs_per_batch, length, config_upload], outputs=runtextbox).then(
|
| 134 |
+
generate, inputs=[config_ready, scaffold_ready, num_batches, num_designs_per_batch, length, config_upload], outputs=[gen_directory, gen_results]
|
| 135 |
).then(
|
| 136 |
update_batch_choices,
|
| 137 |
inputs=gen_results,
|
utils/pipelines.py
CHANGED
|
@@ -7,8 +7,7 @@ import spaces
|
|
| 7 |
import subprocess
|
| 8 |
import gzip
|
| 9 |
from utils.handle_files import *
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
@spaces.GPU(duration=300)
|
| 14 |
def test_rfd3_from_notebook():
|
|
@@ -126,7 +125,8 @@ def unconditional_generation_with_input_config(input_file):
|
|
| 126 |
|
| 127 |
command = f"rfd3 design inputs={input_file} out_dir={directory}"
|
| 128 |
print(f"Running command: {command}")
|
| 129 |
-
subprocess.run(command, shell=True, check=True)
|
|
|
|
| 130 |
|
| 131 |
results = []
|
| 132 |
for file_name in os.listdir(directory):
|
|
@@ -142,7 +142,5 @@ def unconditional_generation_with_input_config(input_file):
|
|
| 142 |
print(results)
|
| 143 |
return directory, results
|
| 144 |
|
| 145 |
-
except
|
| 146 |
-
raise RuntimeError(f"
|
| 147 |
-
|
| 148 |
-
|
|
|
|
| 7 |
import subprocess
|
| 8 |
import gzip
|
| 9 |
from utils.handle_files import *
|
| 10 |
+
import sys
|
|
|
|
| 11 |
|
| 12 |
@spaces.GPU(duration=300)
|
| 13 |
def test_rfd3_from_notebook():
|
|
|
|
| 125 |
|
| 126 |
command = f"rfd3 design inputs={input_file} out_dir={directory}"
|
| 127 |
print(f"Running command: {command}")
|
| 128 |
+
subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
|
| 129 |
+
|
| 130 |
|
| 131 |
results = []
|
| 132 |
for file_name in os.listdir(directory):
|
|
|
|
| 142 |
print(results)
|
| 143 |
return directory, results
|
| 144 |
|
| 145 |
+
except subprocess.CalledProcessError as e:
|
| 146 |
+
raise RuntimeError(f"Subprocess error:\n{e.stderr}") from e
|
|
|
|
|
|