Maharshi Gor
commited on
Commit
·
97fcd0c
1
Parent(s):
55d797c
Reduces white spaces in panel gaps and tab margins.
Browse filesRefactored panel header / subheader from Markdown to HTML component.
- src/components/{quizbowl/commons.py → commons.py} +9 -0
- src/components/model_pipeline/model_pipeline.py +10 -5
- src/components/model_pipeline/tossup_pipeline.py +8 -6
- src/components/quizbowl/bonus.py +2 -1
- src/components/quizbowl/tossup.py +2 -1
- src/display/css_html_js.py +0 -3
- src/display/custom_css.py +18 -5
src/components/{quizbowl/commons.py → commons.py}
RENAMED
@@ -24,3 +24,12 @@ def get_pipeline_selector(model_options: list[str]):
|
|
24 |
container=False,
|
25 |
elem_classes="pipeline-selector",
|
26 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
container=False,
|
25 |
elem_classes="pipeline-selector",
|
26 |
)
|
27 |
+
|
28 |
+
|
29 |
+
def get_panel_header(header: str, subheader: str | None = None):
|
30 |
+
html = f"<h4 class='panel-header'>{header}</h4>"
|
31 |
+
if subheader:
|
32 |
+
html += f"<p class='panel-subheader'>{subheader}</p>"
|
33 |
+
with gr.Row(elem_classes="panel-header-container") as row:
|
34 |
+
gr.HTML(html)
|
35 |
+
return row
|
src/components/model_pipeline/model_pipeline.py
CHANGED
@@ -3,6 +3,7 @@ import yaml
|
|
3 |
from loguru import logger
|
4 |
|
5 |
from app_configs import UNSELECTED_VAR_NAME
|
|
|
6 |
from components.model_pipeline.state_manager import (
|
7 |
ModelStepUIState,
|
8 |
PipelineState,
|
@@ -160,8 +161,9 @@ class PipelineInterface:
|
|
160 |
dropdowns = {}
|
161 |
variable_options = [UNSELECTED_VAR_NAME] + [v for v in available_variables if v not in self.input_variables]
|
162 |
with gr.Column(elem_classes="step-accordion control-panel"):
|
163 |
-
|
164 |
-
|
|
|
165 |
with gr.Row(elem_classes="output-fields-row"):
|
166 |
for output_field in self.required_output_variables:
|
167 |
value = pipeline_state.workflow.outputs.get(output_field, UNSELECTED_VAR_NAME)
|
@@ -214,8 +216,8 @@ class PipelineInterface:
|
|
214 |
else:
|
215 |
instruction = "Create a pipeline that takes in the following input variables and outputs the following output variables:"
|
216 |
gr.Markdown(f"### {instruction}")
|
217 |
-
gr.Markdown(f"Input Variables: {input_variables_str}")
|
218 |
-
gr.Markdown(f"Output Variables: {output_variables_str}")
|
219 |
|
220 |
# if not self.simple:
|
221 |
# self._render_add_step_button(0)
|
@@ -267,9 +269,12 @@ class PipelineInterface:
|
|
267 |
|
268 |
# Add a code box to display the workflow JSON
|
269 |
# with gr.Column(elem_classes="workflow-json-container"):
|
270 |
-
with gr.Accordion(
|
|
|
|
|
271 |
self.config_output = gr.Code(
|
272 |
label="Workflow Configuration",
|
|
|
273 |
language="yaml",
|
274 |
elem_classes="workflow-json",
|
275 |
interactive=True,
|
|
|
3 |
from loguru import logger
|
4 |
|
5 |
from app_configs import UNSELECTED_VAR_NAME
|
6 |
+
from components import commons
|
7 |
from components.model_pipeline.state_manager import (
|
8 |
ModelStepUIState,
|
9 |
PipelineState,
|
|
|
161 |
dropdowns = {}
|
162 |
variable_options = [UNSELECTED_VAR_NAME] + [v for v in available_variables if v not in self.input_variables]
|
163 |
with gr.Column(elem_classes="step-accordion control-panel"):
|
164 |
+
commons.get_panel_header(
|
165 |
+
header="Final output variables mapping:",
|
166 |
+
)
|
167 |
with gr.Row(elem_classes="output-fields-row"):
|
168 |
for output_field in self.required_output_variables:
|
169 |
value = pipeline_state.workflow.outputs.get(output_field, UNSELECTED_VAR_NAME)
|
|
|
216 |
else:
|
217 |
instruction = "Create a pipeline that takes in the following input variables and outputs the following output variables:"
|
218 |
gr.Markdown(f"### {instruction}")
|
219 |
+
gr.Markdown(f"* Input Variables: {input_variables_str}")
|
220 |
+
gr.Markdown(f"* Output Variables: {output_variables_str}")
|
221 |
|
222 |
# if not self.simple:
|
223 |
# self._render_add_step_button(0)
|
|
|
269 |
|
270 |
# Add a code box to display the workflow JSON
|
271 |
# with gr.Column(elem_classes="workflow-json-container"):
|
272 |
+
with gr.Accordion(
|
273 |
+
"Pipeline Preview (click to expand and edit)", open=False, elem_classes="pipeline-preview"
|
274 |
+
) as self.config_accordion:
|
275 |
self.config_output = gr.Code(
|
276 |
label="Workflow Configuration",
|
277 |
+
show_label=False,
|
278 |
language="yaml",
|
279 |
elem_classes="workflow-json",
|
280 |
interactive=True,
|
src/components/model_pipeline/tossup_pipeline.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import numpy as np
|
3 |
|
4 |
from app_configs import AVAILABLE_MODELS, UNSELECTED_VAR_NAME
|
|
|
5 |
from workflows.structs import Buzzer, TossupWorkflow
|
6 |
|
7 |
from .model_pipeline import PipelineInterface, PipelineState, PipelineUIState
|
@@ -86,8 +87,9 @@ class TossupPipelineInterface(PipelineInterface):
|
|
86 |
dropdowns = {}
|
87 |
variable_options = [UNSELECTED_VAR_NAME] + [v for v in available_variables if v not in self.input_variables]
|
88 |
with gr.Column(elem_classes="step-accordion control-panel"):
|
89 |
-
|
90 |
-
|
|
|
91 |
with gr.Row(elem_classes="output-fields-row"):
|
92 |
for output_field in self.required_output_variables:
|
93 |
value = pipeline_state.workflow.outputs.get(output_field, UNSELECTED_VAR_NAME)
|
@@ -105,10 +107,10 @@ class TossupPipelineInterface(PipelineInterface):
|
|
105 |
outputs=[self.pipeline_state],
|
106 |
)
|
107 |
dropdowns[output_field] = dropdown
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
with gr.Row(elem_classes="control-panel"):
|
113 |
self.confidence_slider = gr.Slider(
|
114 |
minimum=0.0,
|
|
|
2 |
import numpy as np
|
3 |
|
4 |
from app_configs import AVAILABLE_MODELS, UNSELECTED_VAR_NAME
|
5 |
+
from components import commons
|
6 |
from workflows.structs import Buzzer, TossupWorkflow
|
7 |
|
8 |
from .model_pipeline import PipelineInterface, PipelineState, PipelineUIState
|
|
|
87 |
dropdowns = {}
|
88 |
variable_options = [UNSELECTED_VAR_NAME] + [v for v in available_variables if v not in self.input_variables]
|
89 |
with gr.Column(elem_classes="step-accordion control-panel"):
|
90 |
+
commons.get_panel_header(
|
91 |
+
header="Final output variables mapping:",
|
92 |
+
)
|
93 |
with gr.Row(elem_classes="output-fields-row"):
|
94 |
for output_field in self.required_output_variables:
|
95 |
value = pipeline_state.workflow.outputs.get(output_field, UNSELECTED_VAR_NAME)
|
|
|
107 |
outputs=[self.pipeline_state],
|
108 |
)
|
109 |
dropdowns[output_field] = dropdown
|
110 |
+
commons.get_panel_header(
|
111 |
+
header="Buzzer settings:",
|
112 |
+
subheader="Set your thresholds for confidence and output tokens probability.",
|
113 |
+
)
|
114 |
with gr.Row(elem_classes="control-panel"):
|
115 |
self.confidence_slider = gr.Slider(
|
116 |
minimum=0.0,
|
src/components/quizbowl/bonus.py
CHANGED
@@ -7,13 +7,14 @@ from datasets import Dataset
|
|
7 |
from loguru import logger
|
8 |
|
9 |
from app_configs import UNSELECTED_PIPELINE_NAME
|
|
|
10 |
from components.model_pipeline.model_pipeline import PipelineInterface, PipelineState, PipelineUIState
|
11 |
from display.formatting import styled_error
|
12 |
from submission import submit
|
13 |
from workflows.qb_agents import QuizBowlBonusAgent
|
14 |
from workflows.structs import ModelStep, Workflow
|
15 |
|
16 |
-
from . import
|
17 |
from .plotting import (
|
18 |
create_bonus_confidence_plot,
|
19 |
create_bonus_html,
|
|
|
7 |
from loguru import logger
|
8 |
|
9 |
from app_configs import UNSELECTED_PIPELINE_NAME
|
10 |
+
from components import commons
|
11 |
from components.model_pipeline.model_pipeline import PipelineInterface, PipelineState, PipelineUIState
|
12 |
from display.formatting import styled_error
|
13 |
from submission import submit
|
14 |
from workflows.qb_agents import QuizBowlBonusAgent
|
15 |
from workflows.structs import ModelStep, Workflow
|
16 |
|
17 |
+
from . import populate
|
18 |
from .plotting import (
|
19 |
create_bonus_confidence_plot,
|
20 |
create_bonus_html,
|
src/components/quizbowl/tossup.py
CHANGED
@@ -8,6 +8,7 @@ from datasets import Dataset
|
|
8 |
from loguru import logger
|
9 |
|
10 |
from app_configs import UNSELECTED_PIPELINE_NAME
|
|
|
11 |
from components.model_pipeline.model_pipeline import PipelineInterface, PipelineState, PipelineUIState
|
12 |
from components.model_pipeline.tossup_pipeline import TossupPipelineInterface, TossupPipelineState
|
13 |
from display.formatting import styled_error
|
@@ -15,7 +16,7 @@ from submission import submit
|
|
15 |
from workflows.qb_agents import QuizBowlTossupAgent, TossupResult
|
16 |
from workflows.structs import ModelStep, TossupWorkflow
|
17 |
|
18 |
-
from . import
|
19 |
from .plotting import (
|
20 |
create_scatter_pyplot,
|
21 |
create_tossup_confidence_pyplot,
|
|
|
8 |
from loguru import logger
|
9 |
|
10 |
from app_configs import UNSELECTED_PIPELINE_NAME
|
11 |
+
from components import commons
|
12 |
from components.model_pipeline.model_pipeline import PipelineInterface, PipelineState, PipelineUIState
|
13 |
from components.model_pipeline.tossup_pipeline import TossupPipelineInterface, TossupPipelineState
|
14 |
from display.formatting import styled_error
|
|
|
16 |
from workflows.qb_agents import QuizBowlTossupAgent, TossupResult
|
17 |
from workflows.structs import ModelStep, TossupWorkflow
|
18 |
|
19 |
+
from . import populate
|
20 |
from .plotting import (
|
21 |
create_scatter_pyplot,
|
22 |
create_tossup_confidence_pyplot,
|
src/display/css_html_js.py
CHANGED
@@ -111,9 +111,6 @@ workflow_json_css = """
|
|
111 |
overflow-y: auto;
|
112 |
}
|
113 |
|
114 |
-
.tab-buttons button {
|
115 |
-
font-size: 20px;
|
116 |
-
}
|
117 |
"""
|
118 |
|
119 |
get_window_url_params = """
|
|
|
111 |
overflow-y: auto;
|
112 |
}
|
113 |
|
|
|
|
|
|
|
114 |
"""
|
115 |
|
116 |
get_window_url_params = """
|
src/display/custom_css.py
CHANGED
@@ -97,6 +97,15 @@ css_pipeline = """
|
|
97 |
gap: 0px
|
98 |
}
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
.step-container {
|
101 |
background-color: var(--card-bg-color);
|
102 |
padding: 0px 0px;
|
@@ -122,7 +131,7 @@ css_pipeline = """
|
|
122 |
}
|
123 |
|
124 |
.control-panel {
|
125 |
-
gap: var(--spacing-
|
126 |
}
|
127 |
|
128 |
.toggleable {
|
@@ -267,13 +276,17 @@ css_pipeline = """
|
|
267 |
gap: 0px !important;
|
268 |
}
|
269 |
|
270 |
-
.
|
271 |
padding: 0px 8px;
|
272 |
}
|
273 |
|
274 |
-
.
|
275 |
-
|
276 |
-
|
|
|
|
|
|
|
|
|
277 |
}
|
278 |
|
279 |
.output-field-variable {
|
|
|
97 |
gap: 0px
|
98 |
}
|
99 |
|
100 |
+
.tabs {
|
101 |
+
gap: var(--spacing-md) !important;
|
102 |
+
}
|
103 |
+
|
104 |
+
.tab-buttons button {
|
105 |
+
font-size: 20px;
|
106 |
+
}
|
107 |
+
|
108 |
+
|
109 |
.step-container {
|
110 |
background-color: var(--card-bg-color);
|
111 |
padding: 0px 0px;
|
|
|
131 |
}
|
132 |
|
133 |
.control-panel {
|
134 |
+
gap: var(--spacing-xs) !important;
|
135 |
}
|
136 |
|
137 |
.toggleable {
|
|
|
276 |
gap: 0px !important;
|
277 |
}
|
278 |
|
279 |
+
.panel-header-container {
|
280 |
padding: 0px 8px;
|
281 |
}
|
282 |
|
283 |
+
.panel-header {
|
284 |
+
margin-bottom: 0px;
|
285 |
+
}
|
286 |
+
|
287 |
+
.panel-subheader {
|
288 |
+
margin-top: 0px;
|
289 |
+
margin-bottom: 0px;
|
290 |
}
|
291 |
|
292 |
.output-field-variable {
|