File tree Expand file tree Collapse file tree 3 files changed +34
-22
lines changed Expand file tree Collapse file tree 3 files changed +34
-22
lines changed Original file line number Diff line number Diff line change @@ -127,17 +127,6 @@ def inference(latest_message, history):
127
127
if settings .theme_background_colour :
128
128
theme .body_background_fill = settings .theme_background_colour
129
129
130
- css_overrides = ""
131
- if settings .theme_title_colour :
132
- css_overrides += """
133
- h1 {{
134
- color: {0};
135
- padding-top: 0.5em;
136
- }}
137
- """ .format (
138
- settings .theme_title_colour
139
- )
140
-
141
130
142
131
def inference_wrapper (* args ):
143
132
"""
@@ -171,12 +160,14 @@ def inference_wrapper(*args):
171
160
scale = 7 ,
172
161
),
173
162
title = settings .page_title ,
163
+ description = settings .page_description ,
174
164
retry_btn = "Retry" ,
175
165
undo_btn = "Undo" ,
176
166
clear_btn = "Clear" ,
177
167
analytics_enabled = False ,
178
168
theme = theme ,
179
- css = css_overrides ,
169
+ css = settings .css_overrides ,
170
+ js = settings .custom_javascript ,
180
171
) as app :
181
172
logger .debug ("Gradio chat interface config: %s" , app .config )
182
173
# For running locally in tilt dev setup
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ class AppSettings(BaseSettings):
33
33
default_factory = lambda : f"http://llm-backend.{ get_k8s_namespace ()} .svc"
34
34
)
35
35
page_title : str = Field (default = "Large Language Model" )
36
+ page_description : Optional [str ] = Field (default = None )
36
37
hf_model_instruction : str = Field (
37
38
default = "You are a helpful and cheerful AI assistant. Please respond appropriately."
38
39
)
@@ -55,8 +56,10 @@ class AppSettings(BaseSettings):
55
56
theme_params : dict [str , Union [str , List [str ]]] = Field (default_factory = dict )
56
57
# Overrides for theme.body_background_fill property
57
58
theme_background_colour : Optional [str ] = Field (default = None )
58
- # Custom page title colour override passed as CSS
59
- theme_title_colour : Optional [str ] = Field (default = None )
59
+ # Provides arbitrary CSS and JS overrides to the UI,
60
+ # see https://www.gradio.app/guides/custom-CSS-and-JS
61
+ css_overrides : Optional [str ] = Field (default = None )
62
+ custom_javascript : Optional [str ] = Field (default = None )
60
63
61
64
# Method for loading settings file
62
65
@staticmethod
Original file line number Diff line number Diff line change @@ -2,21 +2,39 @@ backend_url: http://localhost:8081
2
2
hf_model_name : ise-uiuc/Magicoder-S-DS-6.7B
3
3
4
4
# model_instruction: You are a helpful and cheerful AI assistant. Please respond appropriately.
5
+ # llm_max_tokens:
6
+ # llm_temperature:
7
+ # llm_top_p:
8
+ # llm_frequency_penalty:
9
+ # llm_presence_penalty:
5
10
6
- page_description : " [Privacy statement ](https://google.com)"
11
+ page_description : " [Custom Markdown ](https://google.com)"
7
12
8
13
# UI theming tweaks
9
- # theme_title_colour: white
10
- # theme_background_colour: "#00376c"
14
+ theme_background_colour : " #00376c"
11
15
theme_params :
12
16
# primary_hue: blue
17
+ # Use local system fonts rather than Google fonts API
13
18
font :
14
19
- sans-serif
15
20
font_mono :
16
21
- sans-serif
17
22
18
- # llm_max_tokens:
19
- # llm_temperature:
20
- # llm_top_p:
21
- # llm_frequency_penalty:
22
- # llm_presence_penalty:
23
+ # Customise page title colour
24
+ css_overrides : |
25
+ h1 {
26
+ color: white;
27
+ padding-top: 1em;
28
+ }
29
+
30
+ # Example of a custom JS function which adds a
31
+ # privacy statement link to the page footer
32
+ custom_javascript : |
33
+ function addPrivacyStatement() {
34
+ var footer = document.querySelector('footer');
35
+ footer.appendChild(footer.children[1].cloneNode(deep=true));
36
+ var item = footer.children[2].cloneNode();
37
+ item.href = 'https://gdpr.eu/eu-gdpr-personal-data/';
38
+ item.textContent = 'Privacy Statement';
39
+ footer.appendChild(item);
40
+ }
You can’t perform that action at this time.
0 commit comments