Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,60 +16,56 @@ CITATION_BUTTON_TEXT = """@article{2022,
|
|
16 |
|
17 |
# Load the JSON data
|
18 |
with open('healthsheet.json', 'r') as file:
|
19 |
-
|
20 |
|
21 |
-
def create_tab_interface(json_data):
|
22 |
-
tabs = []
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
gr.Textbox(name=field_name, label=label, lines=3)
|
28 |
-
tabs.append(gr.Tab(tab_name, row))
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
#
|
39 |
-
|
40 |
-
|
41 |
-
#
|
42 |
-
|
43 |
-
|
44 |
-
# value = ABSTRACT_TEXT,
|
45 |
-
# lines = 5,
|
46 |
-
# )
|
47 |
-
# with gr.Row():
|
48 |
-
# with gr.Accordion("π Citation", open=False):
|
49 |
-
# citation_button = gr.Textbox(
|
50 |
-
# value=CITATION_BUTTON_TEXT,
|
51 |
-
# lines=9,
|
52 |
-
# elem_id="citation-button",
|
53 |
-
# ).style(show_copy_button=True)
|
54 |
-
|
55 |
-
# with gr.Row():
|
56 |
-
# with gr.Column():
|
57 |
|
58 |
-
#
|
59 |
-
#
|
60 |
-
#
|
61 |
-
#
|
62 |
|
63 |
-
#
|
64 |
-
#
|
65 |
-
#
|
66 |
-
#
|
67 |
|
68 |
-
#
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
|
|
16 |
|
17 |
# Load the JSON data
|
18 |
with open('healthsheet.json', 'r') as file:
|
19 |
+
json_data = json.load(file)
|
20 |
|
|
|
|
|
21 |
|
22 |
+
with gr.Blocks() as demo:
|
23 |
+
gr.HTML("<h1><center>Healthsheet Creator! πͺπβ¨<h1><center>")
|
24 |
+
gr.HTML('<h3><center>Create a healthsheet based on <a href="https://arxiv.org/abs/2202.13028">Rostamzadeh et al. (2022) <i>"Healthsheet: Development of a Transparency Artifact for Health Datasets"</i></a><h4><center>')
|
|
|
|
|
25 |
|
26 |
+
with gr.Row():
|
27 |
+
with gr.Accordion("π Abstract", open=False):
|
28 |
+
abstract_button = gr.Textbox(
|
29 |
+
value = ABSTRACT_TEXT,
|
30 |
+
lines = 5,
|
31 |
+
)
|
32 |
+
with gr.Row():
|
33 |
+
with gr.Accordion("π Citation", open=False):
|
34 |
+
citation_button = gr.Textbox(
|
35 |
+
value=CITATION_BUTTON_TEXT,
|
36 |
+
lines=9,
|
37 |
+
elem_id="citation-button",
|
38 |
+
).style(show_copy_button=True)
|
39 |
|
40 |
+
with gr.Row():
|
41 |
+
with gr.Column():
|
42 |
|
43 |
+
# Iterating through the first level of JSON (which becomes tabs)
|
44 |
+
for tab_name in json_data:
|
45 |
+
# Creating a new Tab for each first-level key in the JSON
|
46 |
+
with gr.Tab(tab_name):
|
47 |
+
# Iterating through each key-value pair in the second-level dictionary
|
48 |
+
for var_name, label_text in json_data[tab_name].items():
|
49 |
+
# Creating a Textbox for each second-level key in the JSON
|
50 |
+
# Variable name is used as 'name' and label text as 'label' for Textbox
|
51 |
+
gr.Textbox(name=var_name, label=label_text, lines=3)
|
52 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
# with gr.Tab("General Information"):
|
55 |
+
# gr.Markdown("If the answer to any of the questions in the questionnaire is N/A, please describe why the answer is N/A (e.g: data not being available).")
|
56 |
+
# summary = gr.Textbox(label='Provide a 2 sentence summary of this dataset.', lines=3)
|
57 |
+
# audit = gr.Textbox(label='Has the dataset been audited before? If yes, by whom and what are the results?', lines=3)
|
58 |
|
59 |
+
# with gr.Tab("Dataset Versioning"):
|
60 |
+
# gr.Markdown("Version: A dataset will be considered to have a new version if there are major differences from a previous release. Some examples are a change in the number of patients/participants, or an increase in the data modalities covered.")
|
61 |
+
# gr.Markdown("Sub-version: A sub-version tends to apply smaller scale changes to a given version. Some datasets in healthcare are released without labels and predefined tasks, or will be later labeled by researchers for specific tasks and problems, to form sub-versions of the dataset.")
|
62 |
+
# gr.Markdown("The following set of questions clarifies the information about the current (latest) version of the dataset. It is important to report the rationale for labeling the data in any of the versions and sub-versions that this datasheet addresses, funding resources, and motivations behind each released version of the dataset.")
|
63 |
|
64 |
+
# update = gr.Textbox(label='Does the dataset get released as static versions or is it dynamically updated? a. If static, how many versions of the dataset exist? b.If dynamic, how frequently is the dataset updated?')
|
65 |
|
66 |
+
with gr.Column():
|
67 |
+
gr.Markdown("This is where your healthsheet will appear!")
|
68 |
+
gr.Textbox("Healthsheet")
|
69 |
|
70 |
+
if __name__ == "__main__":
|
71 |
+
demo.launch()
|