Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,13 +33,13 @@ def print_healthsheet(healthsheet_dict):
|
|
33 |
question = healthsheet_dict[header][var_name]['question']
|
34 |
answer = healthsheet_dict[header][var_name]['answer']
|
35 |
healthsheet += f"## {question}\n\n"
|
36 |
-
healthsheet += f"
|
37 |
return healthsheet
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
|
44 |
|
45 |
with open('healthsheet.json', 'r') as file:
|
@@ -70,7 +70,7 @@ with gr.Blocks() as demo:
|
|
70 |
for var_name, label_text in json_data[tab_name].items():
|
71 |
answer = gr.Textbox(label=label_text, lines=3)
|
72 |
update_btn = gr.Button("Update")
|
73 |
-
|
74 |
|
75 |
with gr.Column():
|
76 |
gr.Markdown("This is where your Markdown-formatted healthsheet will appear! You can copy and paste it into your dataset card.")
|
|
|
33 |
question = healthsheet_dict[header][var_name]['question']
|
34 |
answer = healthsheet_dict[header][var_name]['answer']
|
35 |
healthsheet += f"## {question}\n\n"
|
36 |
+
healthsheet += f"`{answer}`\n\n"
|
37 |
return healthsheet
|
38 |
|
39 |
+
def update_healthsheet(healthsheet_dict, header, var_name, answer):
|
40 |
+
healthsheet_dict[header][var_name]['answer'] = answer
|
41 |
+
healthsheet = print_healthsheet(healthsheet_dict)
|
42 |
+
return healthsheet_dict, healthsheet
|
43 |
|
44 |
|
45 |
with open('healthsheet.json', 'r') as file:
|
|
|
70 |
for var_name, label_text in json_data[tab_name].items():
|
71 |
answer = gr.Textbox(label=label_text, lines=3)
|
72 |
update_btn = gr.Button("Update")
|
73 |
+
update_btn.click(update_healthsheet, input=[healthsheet_dict, header, var_name, answer], output=[healthsheet_dict, healthsheet])
|
74 |
|
75 |
with gr.Column():
|
76 |
gr.Markdown("This is where your Markdown-formatted healthsheet will appear! You can copy and paste it into your dataset card.")
|