Update app.py
Browse files
app.py
CHANGED
|
@@ -136,22 +136,22 @@ def update_toggle(toggle, farm_output_box, interactions_output_box, trials_outpu
|
|
| 136 |
"""
|
| 137 |
global original_outputs, yaml_outputs
|
| 138 |
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
|
| 156 |
with gr.Blocks() as app:
|
| 157 |
# This is the main driver of the program that sets up the gradio front end pieces, as well as specific interactivity with buttons
|
|
|
|
| 136 |
"""
|
| 137 |
global original_outputs, yaml_outputs
|
| 138 |
|
| 139 |
+
if toggle and not yaml_outputs:
|
| 140 |
+
farm_dict = json.loads(farm_output_box)
|
| 141 |
+
interactions_dict = json.loads(interactions_output_box)
|
| 142 |
+
trials_dict = json.loads(trials_output_box)
|
| 143 |
+
|
| 144 |
+
farm_yaml = yaml.dump(farm_dict)
|
| 145 |
+
interactions_yaml = yaml.dump(interactions_dict)
|
| 146 |
+
trials_yaml = yaml.dump(trials_dict)
|
| 147 |
+
|
| 148 |
+
yaml_outputs = [farm_yaml, interactions_yaml, trials_yaml]
|
| 149 |
+
|
| 150 |
+
return farm_yaml, interactions_yaml, trials_yaml
|
| 151 |
+
elif toggle and yaml_outputs:
|
| 152 |
+
return yaml_outputs[0], yaml_outputs[1], yaml_outputs[2]
|
| 153 |
+
else:
|
| 154 |
+
return original_outputs[0], original_outputs[1], original_outputs[2]
|
| 155 |
|
| 156 |
with gr.Blocks() as app:
|
| 157 |
# This is the main driver of the program that sets up the gradio front end pieces, as well as specific interactivity with buttons
|