Spaces:
Running on Zero
Running on Zero
Upload folder using huggingface_hub
Browse files- space_ui/css.py +6 -13
- space_ui/texts.py +25 -1
space_ui/css.py
CHANGED
|
@@ -62,7 +62,7 @@ theme = gr.themes.Soft(
|
|
| 62 |
)
|
| 63 |
|
| 64 |
CSS = """
|
| 65 |
-
|
| 66 |
.gradio-container { width: 1020px !important; max-width: calc(100vw - 32px) !important; min-width: 0 !important; box-sizing: border-box !important; margin: 0 auto; }
|
| 67 |
footer { visibility: hidden; }
|
| 68 |
:root, .gradio-container { --primary-pastel: #e8b48c; --color-accent: var(--primary-pastel); --border-color-accent: var(--primary-pastel); }
|
|
@@ -82,10 +82,9 @@ footer { visibility: hidden; }
|
|
| 82 |
.gradio-container label, .gradio-container .form-label, .gradio-container .block-label { font-size: 12px; line-height: 1.4; font-weight: 500; }
|
| 83 |
.gradio-container button, .tab-nav button { font-size: 13px; line-height: 1.25; }
|
| 84 |
|
| 85 |
-
|
| 86 |
.gradio-container * { border-radius: 0 !important; }
|
| 87 |
|
| 88 |
-
/* --- header --- */
|
| 89 |
#header { padding: 12px 0 16px; border-bottom: 1px solid var(--border-color-primary);
|
| 90 |
margin-bottom: 16px; }
|
| 91 |
#header h1 { margin: 0 0 8px; letter-spacing: -0.01em; }
|
|
@@ -95,27 +94,24 @@ footer { visibility: hidden; }
|
|
| 95 |
letter-spacing: 0.02em; }
|
| 96 |
#header .metrics b { color: var(--body-text-color); font-weight: 600; }
|
| 97 |
|
| 98 |
-
|
| 99 |
#presets { gap: 8px; margin-bottom: 16px; }
|
| 100 |
#presets button { flex: 1 1 0; min-width: 0; width: auto; height: 32px !important;
|
| 101 |
min-height: 32px !important; padding: 0 12px !important; }
|
| 102 |
|
| 103 |
-
/* --- accordion header matches the preset button height --- */
|
| 104 |
#qs-help { margin: 12px 0; }
|
| 105 |
#qs-help button { min-height: 32px !important; padding: 4px 12px !important; }
|
| 106 |
|
| 107 |
-
|
| 108 |
#decide-btn { width: 100%; min-height: 40px; margin-top: 16px; }
|
| 109 |
.tab-container .row { gap: 16px; }
|
| 110 |
|
| 111 |
-
/* --- code editors and viewers render mono --- */
|
| 112 |
.cm-editor, .cm-content, .cm-line, textarea.code,
|
| 113 |
#state-box textarea, #qs-box textarea {
|
| 114 |
font-family: var(--font-mono) !important;
|
| 115 |
font-size: 12px !important;
|
| 116 |
}
|
| 117 |
|
| 118 |
-
/* --- probability bars rendered from the payload markdown --- */
|
| 119 |
.bars .qname { display: block; font-size: 12px; text-transform: uppercase;
|
| 120 |
letter-spacing: 0.1em; color: var(--body-text-color-subdued);
|
| 121 |
margin: 16px 0 8px; }
|
|
@@ -133,23 +129,20 @@ footer { visibility: hidden; }
|
|
| 133 |
color: var(--body-text-color-subdued); }
|
| 134 |
.bars .row.win .val { color: var(--body-text-color); font-weight: 600; }
|
| 135 |
|
| 136 |
-
/* --- status line --- */
|
| 137 |
#statusline { font-family: var(--font-mono); font-size: 12px;
|
| 138 |
color: var(--body-text-color-subdued); text-align: right;
|
| 139 |
min-height: 1.4em; margin-top: 8px; }
|
| 140 |
|
| 141 |
-
|
| 142 |
#errorbox { margin: 12px 0; padding: 12px;
|
| 143 |
border-left: 3px solid var(--color-danger) !important; }
|
| 144 |
|
| 145 |
-
/* --- focus rings --- */
|
| 146 |
#state-box textarea:focus, #qs-box textarea:focus, #qs-box input:focus,
|
| 147 |
.cm-editor.cm-focused, .cm-content:focus {
|
| 148 |
outline: 2px solid var(--border-color-accent) !important;
|
| 149 |
outline-offset: -1px;
|
| 150 |
}
|
| 151 |
|
| 152 |
-
/* --- tab nav --- */
|
| 153 |
.tab-nav { display: flex; width: 100%; gap: 8px; margin-bottom: 16px; }
|
| 154 |
.tab-nav button { flex: 1 1 0; min-width: 0; min-height: 32px; padding: 6px 12px; font-size: 13px; letter-spacing: 0.04em; }
|
| 155 |
.tab-nav button:hover,
|
|
@@ -168,7 +161,7 @@ footer { visibility: hidden; }
|
|
| 168 |
-webkit-text-fill-color: var(--color-accent) !important;
|
| 169 |
}
|
| 170 |
|
| 171 |
-
|
| 172 |
@media (max-width: 640px) {
|
| 173 |
#presets { flex-wrap: wrap; }
|
| 174 |
#presets button { flex: 1 1 45%; width: auto; }
|
|
|
|
| 62 |
)
|
| 63 |
|
| 64 |
CSS = """
|
| 65 |
+
# page frame: centered column
|
| 66 |
.gradio-container { width: 1020px !important; max-width: calc(100vw - 32px) !important; min-width: 0 !important; box-sizing: border-box !important; margin: 0 auto; }
|
| 67 |
footer { visibility: hidden; }
|
| 68 |
:root, .gradio-container { --primary-pastel: #e8b48c; --color-accent: var(--primary-pastel); --border-color-accent: var(--primary-pastel); }
|
|
|
|
| 82 |
.gradio-container label, .gradio-container .form-label, .gradio-container .block-label { font-size: 12px; line-height: 1.4; font-weight: 500; }
|
| 83 |
.gradio-container button, .tab-nav button { font-size: 13px; line-height: 1.25; }
|
| 84 |
|
| 85 |
+
# everything square: override any gradio rounding
|
| 86 |
.gradio-container * { border-radius: 0 !important; }
|
| 87 |
|
|
|
|
| 88 |
#header { padding: 12px 0 16px; border-bottom: 1px solid var(--border-color-primary);
|
| 89 |
margin-bottom: 16px; }
|
| 90 |
#header h1 { margin: 0 0 8px; letter-spacing: -0.01em; }
|
|
|
|
| 94 |
letter-spacing: 0.02em; }
|
| 95 |
#header .metrics b { color: var(--body-text-color); font-weight: 600; }
|
| 96 |
|
| 97 |
+
# preset buttons: equal width, one row
|
| 98 |
#presets { gap: 8px; margin-bottom: 16px; }
|
| 99 |
#presets button { flex: 1 1 0; min-width: 0; width: auto; height: 32px !important;
|
| 100 |
min-height: 32px !important; padding: 0 12px !important; }
|
| 101 |
|
|
|
|
| 102 |
#qs-help { margin: 12px 0; }
|
| 103 |
#qs-help button { min-height: 32px !important; padding: 4px 12px !important; }
|
| 104 |
|
| 105 |
+
# decide: full width, own row
|
| 106 |
#decide-btn { width: 100%; min-height: 40px; margin-top: 16px; }
|
| 107 |
.tab-container .row { gap: 16px; }
|
| 108 |
|
|
|
|
| 109 |
.cm-editor, .cm-content, .cm-line, textarea.code,
|
| 110 |
#state-box textarea, #qs-box textarea {
|
| 111 |
font-family: var(--font-mono) !important;
|
| 112 |
font-size: 12px !important;
|
| 113 |
}
|
| 114 |
|
|
|
|
| 115 |
.bars .qname { display: block; font-size: 12px; text-transform: uppercase;
|
| 116 |
letter-spacing: 0.1em; color: var(--body-text-color-subdued);
|
| 117 |
margin: 16px 0 8px; }
|
|
|
|
| 129 |
color: var(--body-text-color-subdued); }
|
| 130 |
.bars .row.win .val { color: var(--body-text-color); font-weight: 600; }
|
| 131 |
|
|
|
|
| 132 |
#statusline { font-family: var(--font-mono); font-size: 12px;
|
| 133 |
color: var(--body-text-color-subdued); text-align: right;
|
| 134 |
min-height: 1.4em; margin-top: 8px; }
|
| 135 |
|
| 136 |
+
# error: red left rule
|
| 137 |
#errorbox { margin: 12px 0; padding: 12px;
|
| 138 |
border-left: 3px solid var(--color-danger) !important; }
|
| 139 |
|
|
|
|
| 140 |
#state-box textarea:focus, #qs-box textarea:focus, #qs-box input:focus,
|
| 141 |
.cm-editor.cm-focused, .cm-content:focus {
|
| 142 |
outline: 2px solid var(--border-color-accent) !important;
|
| 143 |
outline-offset: -1px;
|
| 144 |
}
|
| 145 |
|
|
|
|
| 146 |
.tab-nav { display: flex; width: 100%; gap: 8px; margin-bottom: 16px; }
|
| 147 |
.tab-nav button { flex: 1 1 0; min-width: 0; min-height: 32px; padding: 6px 12px; font-size: 13px; letter-spacing: 0.04em; }
|
| 148 |
.tab-nav button:hover,
|
|
|
|
| 161 |
-webkit-text-fill-color: var(--color-accent) !important;
|
| 162 |
}
|
| 163 |
|
| 164 |
+
# responsive: presets wrap on narrow screens
|
| 165 |
@media (max-width: 640px) {
|
| 166 |
#presets { flex-wrap: wrap; }
|
| 167 |
#presets button { flex: 1 1 45%; width: auto; }
|
space_ui/texts.py
CHANGED
|
@@ -7,7 +7,11 @@ TITLE_MD = """
|
|
| 7 |
</div>
|
| 8 |
"""
|
| 9 |
|
| 10 |
-
QS_HELP = """**Question schema** - one JSON object per question name
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
```json
|
| 13 |
{
|
|
@@ -19,6 +23,22 @@ QS_HELP = """**Question schema** - one JSON object per question name:
|
|
| 19 |
}
|
| 20 |
}
|
| 21 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
API_DOCS = r"""## Use OEV from code
|
|
@@ -59,4 +79,8 @@ from oev.infer import OEV
|
|
| 59 |
agent = OEV("divyanshudhruv/oev-typed/student-r3-oev-tiny.pt")
|
| 60 |
result = agent.decide(state, questions)
|
| 61 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
"""
|
|
|
|
| 7 |
</div>
|
| 8 |
"""
|
| 9 |
|
| 10 |
+
QS_HELP = """**Question schema** - one JSON object per question name. Two
|
| 11 |
+
equivalent forms are accepted: the native one and the Jev/TypeSafe
|
| 12 |
+
`criteria` one (so existing laya/Kev clients work as-is).
|
| 13 |
+
|
| 14 |
+
Native (what the presets use):
|
| 15 |
|
| 16 |
```json
|
| 17 |
{
|
|
|
|
| 23 |
}
|
| 24 |
}
|
| 25 |
```
|
| 26 |
+
|
| 27 |
+
Jev/TypeSafe `criteria` - descriptions are ignored, the keys become the
|
| 28 |
+
options (choice) and the list items become the levels (score):
|
| 29 |
+
|
| 30 |
+
```json
|
| 31 |
+
{
|
| 32 |
+
"question_name": {
|
| 33 |
+
"type": "choice",
|
| 34 |
+
"criteria": {"billing": "invoices, payments", "technical": "bugs, outages"}
|
| 35 |
+
},
|
| 36 |
+
"quality": {
|
| 37 |
+
"type": "score",
|
| 38 |
+
"criteria": ["poor", "mixed", "good"]
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
```
|
| 42 |
"""
|
| 43 |
|
| 44 |
API_DOCS = r"""## Use OEV from code
|
|
|
|
| 79 |
agent = OEV("divyanshudhruv/oev-typed/student-r3-oev-tiny.pt")
|
| 80 |
result = agent.decide(state, questions)
|
| 81 |
```
|
| 82 |
+
|
| 83 |
+
Questions accept both the native schema and the Jev/TypeSafe `criteria`
|
| 84 |
+
form (`criteria` map for choice, list for score) - see the schema help
|
| 85 |
+
in the Playground tab.
|
| 86 |
"""
|