Spaces:
Runtime error
Runtime error
add interactivity for rows and submission confirmation
Browse files
app.py
CHANGED
@@ -1,12 +1,36 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
css = """
|
4 |
.plugin-accordion button span:first-child {
|
5 |
font-size: 1.25rem !important;
|
6 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
"""
|
8 |
|
9 |
-
with gr.Blocks(css=css) as registry_submit:
|
10 |
gr.Markdown("# ๐ Impact Framework Plugin Registry Submission")
|
11 |
|
12 |
with gr.Accordion("โน๏ธ About this Page",open=False,elem_classes=["plugin-accordion"]):
|
@@ -32,10 +56,19 @@ with gr.Blocks(css=css) as registry_submit:
|
|
32 |
plugin_input_1 = gr.Textbox(placeholder="Input name", label="Input Name", info="What is the name of the input?",scale=2)
|
33 |
plugin_input_1_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Input Type",value="Text",interactive=True,info="What data type does your input expect",scale=2)
|
34 |
plugin_input_1_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the input expect?",scale=2)
|
|
|
35 |
plugin_input_1_required = gr.Checkbox(label="Required", value=False,scale=1)
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
with gr.Row(elem_classes=["input-row"]):
|
38 |
-
plugin_add_input = gr.Button("Add Input")
|
39 |
|
40 |
with gr.Accordion("Plugin Outputs",open=True,elem_classes=["plugin-accordion"]):
|
41 |
gr.Markdown("This is the data your plugin will return")
|
@@ -45,8 +78,13 @@ with gr.Blocks(css=css) as registry_submit:
|
|
45 |
plugin_output_1_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Output Type",value="Text",interactive=True,info="What data type does your output expect")
|
46 |
plugin_output_1_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the output expect?")
|
47 |
|
|
|
|
|
|
|
|
|
|
|
48 |
with gr.Row(elem_classes=["output-row"]):
|
49 |
-
plugin_add_output = gr.Button("Add Output")
|
50 |
|
51 |
with gr.Accordion("Plugin Data",open=True,elem_classes=["plugin-accordion"]):
|
52 |
gr.Markdown("This is where you put information about your plugin's data sources and assumptions")
|
@@ -72,7 +110,7 @@ with gr.Blocks(css=css) as registry_submit:
|
|
72 |
with gr.Column():
|
73 |
gr.Markdown("Alternatively, search for plugins that are compatible with your required inputs")
|
74 |
# a button to help users find compatible plugins
|
75 |
-
plugin_find_input_plugin = gr.Button("Find Compatible Plugins")
|
76 |
gr.Button("Add Input Plugin")
|
77 |
|
78 |
gr.Markdown("## Dependent Plugins")
|
@@ -83,10 +121,16 @@ with gr.Blocks(css=css) as registry_submit:
|
|
83 |
plugin_output_plugin_1 = gr.Textbox(placeholder="https://greensoftware.foundation/if/[ID]", label="Plugin URL", info="Enter the impact framework registry URL where the plugin can be found")
|
84 |
with gr.Column():
|
85 |
gr.Markdown("Alternatively, search for plugins that are compatible with your output")
|
86 |
-
plugin_find_output_plugin = gr.Button("Find Compatible Plugins")
|
87 |
gr.Button("Add Output Plugin")
|
88 |
|
89 |
-
gr.Button("Submit Plugin",variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
|
92 |
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
js = """
|
4 |
+
function appJS() {
|
5 |
+
document.getElementById("plugin_add_input").addEventListener("click", function() {
|
6 |
+
document.getElementById("input-row-2").classList.toggle("active",true);
|
7 |
+
});
|
8 |
+
|
9 |
+
document.getElementById("plugin_add_output").addEventListener("click", function() {
|
10 |
+
document.getElementById("output-row-2").classList.toggle("active",true);
|
11 |
+
});
|
12 |
+
|
13 |
+
document.getElementById("submit-button").addEventListener("click", function() {
|
14 |
+
document.getElementById("confirmation-row").classList.toggle("active",true);
|
15 |
+
});
|
16 |
+
}
|
17 |
+
"""
|
18 |
+
|
19 |
css = """
|
20 |
.plugin-accordion button span:first-child {
|
21 |
font-size: 1.25rem !important;
|
22 |
}
|
23 |
+
|
24 |
+
.dependent-row {
|
25 |
+
display: none !important;
|
26 |
+
}
|
27 |
+
|
28 |
+
.dependent-row.active {
|
29 |
+
display: block !important;
|
30 |
+
}
|
31 |
"""
|
32 |
|
33 |
+
with gr.Blocks(css=css,js=js) as registry_submit:
|
34 |
gr.Markdown("# ๐ Impact Framework Plugin Registry Submission")
|
35 |
|
36 |
with gr.Accordion("โน๏ธ About this Page",open=False,elem_classes=["plugin-accordion"]):
|
|
|
56 |
plugin_input_1 = gr.Textbox(placeholder="Input name", label="Input Name", info="What is the name of the input?",scale=2)
|
57 |
plugin_input_1_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Input Type",value="Text",interactive=True,info="What data type does your input expect",scale=2)
|
58 |
plugin_input_1_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the input expect?",scale=2)
|
59 |
+
plugin_1_example = gr.Textbox(placeholder="Your sample value", label="Example", info="Provide an example value for this input",scale=2)
|
60 |
plugin_input_1_required = gr.Checkbox(label="Required", value=False,scale=1)
|
61 |
|
62 |
+
with gr.Row(elem_classes=["input-row","dependent-row"],elem_id="input-row-2", variant="panel"):
|
63 |
+
plugin_input_2 = gr.Textbox(placeholder="Input name", label="Input Name", info="What is the name of the input?",scale=2)
|
64 |
+
plugin_input_2_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Input Type",value="Text",interactive=True,info="What data type does your input expect",scale=2)
|
65 |
+
plugin_input_2_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the input expect?",scale=2)
|
66 |
+
plugin_2_example = gr.Textbox(placeholder="Your sample value", label="Example", info="Provide an example value for this input",scale=2)
|
67 |
+
plugin_input_2_required = gr.Checkbox(label="Required", value=False,scale=1)
|
68 |
+
|
69 |
+
|
70 |
with gr.Row(elem_classes=["input-row"]):
|
71 |
+
plugin_add_input = gr.Button("Add Input",elem_id="plugin_add_input")
|
72 |
|
73 |
with gr.Accordion("Plugin Outputs",open=True,elem_classes=["plugin-accordion"]):
|
74 |
gr.Markdown("This is the data your plugin will return")
|
|
|
78 |
plugin_output_1_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Output Type",value="Text",interactive=True,info="What data type does your output expect")
|
79 |
plugin_output_1_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the output expect?")
|
80 |
|
81 |
+
with gr.Row(elem_classes=["output-row","dependent-row"],elem_id="output-row-2",variant="panel"):
|
82 |
+
plugin_output_2 = gr.Textbox(placeholder="Output name", label="Output Name", info="What is the name of the output?")
|
83 |
+
plugin_output_2_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Output Type",value="Text",interactive=True,info="What data type does your output expect")
|
84 |
+
plugin_output_2_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the output expect?")
|
85 |
+
|
86 |
with gr.Row(elem_classes=["output-row"]):
|
87 |
+
plugin_add_output = gr.Button("Add Output",elem_id="plugin_add_output")
|
88 |
|
89 |
with gr.Accordion("Plugin Data",open=True,elem_classes=["plugin-accordion"]):
|
90 |
gr.Markdown("This is where you put information about your plugin's data sources and assumptions")
|
|
|
110 |
with gr.Column():
|
111 |
gr.Markdown("Alternatively, search for plugins that are compatible with your required inputs")
|
112 |
# a button to help users find compatible plugins
|
113 |
+
plugin_find_input_plugin = gr.Button("Find Compatible Plugins",interactive=False)
|
114 |
gr.Button("Add Input Plugin")
|
115 |
|
116 |
gr.Markdown("## Dependent Plugins")
|
|
|
121 |
plugin_output_plugin_1 = gr.Textbox(placeholder="https://greensoftware.foundation/if/[ID]", label="Plugin URL", info="Enter the impact framework registry URL where the plugin can be found")
|
122 |
with gr.Column():
|
123 |
gr.Markdown("Alternatively, search for plugins that are compatible with your output")
|
124 |
+
plugin_find_output_plugin = gr.Button("Find Compatible Plugins",interactive=False)
|
125 |
gr.Button("Add Output Plugin")
|
126 |
|
127 |
+
gr.Button("Submit Plugin",variant="primary",elem_id="submit-button")
|
128 |
+
|
129 |
+
with gr.Row(elem_classes=["dependent-row"],variant="panel",elem_id="confirmation-row"):
|
130 |
+
with gr.Column():
|
131 |
+
gr.Markdown("## Submission Confirmed โ๏ธ")
|
132 |
+
gr.Markdown("Thank you for submitting your plugin to the Impact Framework Registry. We will review your submission and get back to you soon.")
|
133 |
+
|
134 |
|
135 |
|
136 |
|