Spaces:
Running
Running
Commit
·
6efc321
1
Parent(s):
bf3fe90
fix: carbon theme sizing and more design feedback
Browse filesSigned-off-by: Graham White <[email protected]>
- src/app.css +6 -4
- src/app.py +2 -4
- src/themes/carbon.py +7 -5
src/app.css
CHANGED
@@ -4,7 +4,7 @@ footer {
|
|
4 |
}
|
5 |
/* Make the text in the input box and chat label bigger */
|
6 |
textarea, .wrapper > label {
|
7 |
-
font-size:
|
8 |
}
|
9 |
.input-container {
|
10 |
align-items: center;
|
@@ -31,9 +31,11 @@ textarea, .wrapper > label {
|
|
31 |
height: 42px;
|
32 |
width: 42px;
|
33 |
margin-right: 1rem;
|
34 |
-
margin-bottom: -6px;
|
35 |
filter: invert(0%) sepia(0%) saturate(7459%) hue-rotate(154deg) brightness(96%) contrast(100%);
|
36 |
}
|
|
|
|
|
|
|
37 |
/* Color the Granite icon in white for dark mode */
|
38 |
@media (prefers-color-scheme: dark) {
|
39 |
.gr_title img {
|
@@ -55,6 +57,6 @@ textarea, .wrapper > label {
|
|
55 |
margin-bottom: auto;
|
56 |
}
|
57 |
/* Centre the values in advanced settings */
|
58 |
-
.tab-like-container
|
59 |
-
|
60 |
}
|
|
|
4 |
}
|
5 |
/* Make the text in the input box and chat label bigger */
|
6 |
textarea, .wrapper > label {
|
7 |
+
font-size: var(--text-md)
|
8 |
}
|
9 |
.input-container {
|
10 |
align-items: center;
|
|
|
31 |
height: 42px;
|
32 |
width: 42px;
|
33 |
margin-right: 1rem;
|
|
|
34 |
filter: invert(0%) sepia(0%) saturate(7459%) hue-rotate(154deg) brightness(96%) contrast(100%);
|
35 |
}
|
36 |
+
.gr_title h1 {
|
37 |
+
margin: auto !important;
|
38 |
+
}
|
39 |
/* Color the Granite icon in white for dark mode */
|
40 |
@media (prefers-color-scheme: dark) {
|
41 |
.gr_title img {
|
|
|
57 |
margin-bottom: auto;
|
58 |
}
|
59 |
/* Centre the values in advanced settings */
|
60 |
+
.tab-like-container {
|
61 |
+
align-items: center;
|
62 |
}
|
src/app.py
CHANGED
@@ -10,7 +10,7 @@ import spaces
|
|
10 |
import torch
|
11 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
12 |
|
13 |
-
from themes.carbon import
|
14 |
|
15 |
today_date = datetime.today().strftime("%B %-d, %Y") # noqa: DTZ002
|
16 |
|
@@ -125,9 +125,7 @@ max_new_tokens_slider = gr.Slider(
|
|
125 |
)
|
126 |
chat_interface_accordion = gr.Accordion(label="Advanced Settings", open=False)
|
127 |
|
128 |
-
with gr.Blocks(
|
129 |
-
fill_height=True, css_paths=css_file_path, head_paths=head_file_path, theme=carbon_theme, title=TITLE
|
130 |
-
) as demo:
|
131 |
gr.HTML(
|
132 |
f"<img src='https://www.ibm.com/granite/docs/images/granite-pictogram.svg'/><h1>{TITLE}</h1>",
|
133 |
elem_classes=["gr_title"],
|
|
|
10 |
import torch
|
11 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
12 |
|
13 |
+
from themes.carbon import theme
|
14 |
|
15 |
today_date = datetime.today().strftime("%B %-d, %Y") # noqa: DTZ002
|
16 |
|
|
|
125 |
)
|
126 |
chat_interface_accordion = gr.Accordion(label="Advanced Settings", open=False)
|
127 |
|
128 |
+
with gr.Blocks(fill_height=True, css_paths=css_file_path, head_paths=head_file_path, theme=theme, title=TITLE) as demo:
|
|
|
|
|
129 |
gr.HTML(
|
130 |
f"<img src='https://www.ibm.com/granite/docs/images/granite-pictogram.svg'/><h1>{TITLE}</h1>",
|
131 |
elem_classes=["gr_title"],
|
src/themes/carbon.py
CHANGED
@@ -6,8 +6,9 @@ Bee.
|
|
6 |
"""
|
7 |
|
8 |
import gradio as gr
|
|
|
9 |
|
10 |
-
|
11 |
primary_hue=gr.themes.Color(
|
12 |
c100="#EDF5FF",
|
13 |
c200="#D0E2FF",
|
@@ -47,9 +48,9 @@ carbon_theme = gr.themes.Base(
|
|
47 |
c900="#21272A",
|
48 |
c950="#121619",
|
49 |
),
|
50 |
-
text_size=
|
51 |
-
spacing_size=
|
52 |
-
radius_size=
|
53 |
font=["IBM Plex Sans", "ui-sans-serif", "system-ui", "sans-serif"],
|
54 |
font_mono=["IBM Plex Mono", "ui-monospace", "Consolas", "monospace"],
|
55 |
).set(
|
@@ -66,6 +67,7 @@ carbon_theme = gr.themes.Base(
|
|
66 |
block_border_color="*neutral_200", # The border color around an block
|
67 |
block_label_background_fill="white", # The background color for the block label
|
68 |
block_label_border_color="*neutral_100", # The border color for the block label
|
|
|
69 |
background_fill_secondary="*background_fill_primary",
|
70 |
background_fill_secondary_dark="*neutral_950",
|
71 |
border_color_accent="*neutral_100",
|
@@ -85,7 +87,7 @@ carbon_theme = gr.themes.Base(
|
|
85 |
shadow_drop_lg="0px 1px 2px 0px rgba(0, 0, 0, 0.07)",
|
86 |
shadow_inset="0px 2px 4px 0px rgba(0, 0, 0, 0.07) inset, 0px 0px 3px 0px rgba(0, 0, 0, 0.00) inset",
|
87 |
shadow_spread="1px",
|
88 |
-
chatbot_text_size="*
|
89 |
checkbox_background_color_hover="*neutral_50",
|
90 |
checkbox_background_color_hover_dark="*neutral_50",
|
91 |
checkbox_background_color_selected="*neutral_800",
|
|
|
6 |
"""
|
7 |
|
8 |
import gradio as gr
|
9 |
+
from gradio.themes.utils import sizes
|
10 |
|
11 |
+
theme = gr.themes.Base(
|
12 |
primary_hue=gr.themes.Color(
|
13 |
c100="#EDF5FF",
|
14 |
c200="#D0E2FF",
|
|
|
48 |
c900="#21272A",
|
49 |
c950="#121619",
|
50 |
),
|
51 |
+
text_size=sizes.text_lg,
|
52 |
+
spacing_size=sizes.spacing_md,
|
53 |
+
radius_size=sizes.radius_md,
|
54 |
font=["IBM Plex Sans", "ui-sans-serif", "system-ui", "sans-serif"],
|
55 |
font_mono=["IBM Plex Mono", "ui-monospace", "Consolas", "monospace"],
|
56 |
).set(
|
|
|
67 |
block_border_color="*neutral_200", # The border color around an block
|
68 |
block_label_background_fill="white", # The background color for the block label
|
69 |
block_label_border_color="*neutral_100", # The border color for the block label
|
70 |
+
block_label_margin="*spacing_md",
|
71 |
background_fill_secondary="*background_fill_primary",
|
72 |
background_fill_secondary_dark="*neutral_950",
|
73 |
border_color_accent="*neutral_100",
|
|
|
87 |
shadow_drop_lg="0px 1px 2px 0px rgba(0, 0, 0, 0.07)",
|
88 |
shadow_inset="0px 2px 4px 0px rgba(0, 0, 0, 0.07) inset, 0px 0px 3px 0px rgba(0, 0, 0, 0.00) inset",
|
89 |
shadow_spread="1px",
|
90 |
+
chatbot_text_size="*text_md", # make it larger
|
91 |
checkbox_background_color_hover="*neutral_50",
|
92 |
checkbox_background_color_hover_dark="*neutral_50",
|
93 |
checkbox_background_color_selected="*neutral_800",
|