Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,8 @@ import yaml
|
|
| 9 |
#from process_data import parse_survey_stack_parameters, parse_survey_stack_data, process_specifications
|
| 10 |
from process_data import parse_survey_stack, process_specifications
|
| 11 |
|
|
|
|
|
|
|
| 12 |
global original_outputs, yaml_outputs
|
| 13 |
|
| 14 |
#def process_survey(button_type, survey_submission_ID):
|
|
@@ -228,7 +230,14 @@ def update_toggle(toggle, farm_output_box, interactions_output_box, trials_outpu
|
|
| 228 |
return yaml_outputs[0], yaml_outputs[1], yaml_outputs[2]
|
| 229 |
else:
|
| 230 |
return original_outputs[0], original_outputs[1], original_outputs[2]
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
with gr.Blocks() as app:
|
| 233 |
# This is the main driver of the program that sets up the gradio front end pieces, as well as specific interactivity with buttons
|
| 234 |
with gr.Row():
|
|
@@ -261,6 +270,15 @@ with gr.Blocks() as app:
|
|
| 261 |
inputs=survey_submission_ID,
|
| 262 |
outputs=[get_survey_back, json_output_farm, json_output_interactions, json_output_trials, json_output_farm, json_output_interactions, json_output_trials, toggle_output]
|
| 263 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
#param_submit_button.click(
|
| 266 |
# lambda button_type: process_survey("param", button_type),
|
|
|
|
| 9 |
#from process_data import parse_survey_stack_parameters, parse_survey_stack_data, process_specifications
|
| 10 |
from process_data import parse_survey_stack, process_specifications
|
| 11 |
|
| 12 |
+
from script_for_automation import drive_process
|
| 13 |
+
|
| 14 |
global original_outputs, yaml_outputs
|
| 15 |
|
| 16 |
#def process_survey(button_type, survey_submission_ID):
|
|
|
|
| 230 |
return yaml_outputs[0], yaml_outputs[1], yaml_outputs[2]
|
| 231 |
else:
|
| 232 |
return original_outputs[0], original_outputs[1], original_outputs[2]
|
| 233 |
+
|
| 234 |
+
def generate_output_and_download():
|
| 235 |
+
zip_file_path = drive_process()
|
| 236 |
+
if os.path.exists(zip_file_path):
|
| 237 |
+
return zip_file_path
|
| 238 |
+
else:
|
| 239 |
+
return "Error: Output Folder not generated".
|
| 240 |
+
|
| 241 |
with gr.Blocks() as app:
|
| 242 |
# This is the main driver of the program that sets up the gradio front end pieces, as well as specific interactivity with buttons
|
| 243 |
with gr.Row():
|
|
|
|
| 270 |
inputs=survey_submission_ID,
|
| 271 |
outputs=[get_survey_back, json_output_farm, json_output_interactions, json_output_trials, json_output_farm, json_output_interactions, json_output_trials, toggle_output]
|
| 272 |
)
|
| 273 |
+
|
| 274 |
+
generate_output_button = gr.Button("Generate Output Folder and Download")
|
| 275 |
+
|
| 276 |
+
generate_output_button.click(
|
| 277 |
+
fn=generate_output_and_download,
|
| 278 |
+
inputs=[],
|
| 279 |
+
outputs=[gr.File(label="Download Output Folder")]
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
|
| 283 |
#param_submit_button.click(
|
| 284 |
# lambda button_type: process_survey("param", button_type),
|