escc commited on
Commit
f514b2d
·
verified ·
1 Parent(s): 37223cd

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -33,13 +33,17 @@ def respond(q, history):
33
  return chat([{"role": "system", "content": SYSTEM}] + hist + [{"role": "user", "content": ctx(sq) + "\n\nQuestion: " + q}])
34
 
35
  css = ".gradio-container { --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }"
36
- c = dict( # the site's embed colours, used in both light and dark mode so visitors always see them
37
- body_background_fill="#ffffff", body_text_color="#000000", body_text_color_subdued="#5b7fa6",
38
- background_fill_primary="#ffffff", background_fill_secondary="#f6f9fc", block_background_fill="#ffffff", input_background_fill="#ffffff",
39
- border_color_primary="#c9dcee", block_border_color="#c9dcee", input_border_color="#c9dcee", input_border_color_focus="#0466C8",
40
- border_color_accent_subdued="#c9dcee", color_accent="#0466C8", color_accent_soft="#eaf4fd", link_text_color="#0466C8",
41
- button_primary_background_fill="#0466C8", button_primary_background_fill_hover="#2f9ce8", button_primary_text_color="#ffffff")
42
- theme = gr.themes.Base().set(**c, **{k + "_dark": v for k, v in c.items() if k != "color_accent"},
 
 
 
 
43
  block_radius="8px", input_radius="6px", button_large_radius="6px", button_small_radius="6px")
44
 
45
  gr.ChatInterface(respond, title="Eco", description="Questions about nature, climate and the environment.").launch(theme=theme, css=css)
 
33
  return chat([{"role": "system", "content": SYSTEM}] + hist + [{"role": "user", "content": ctx(sq) + "\n\nQuestion: " + q}])
34
 
35
  css = ".gradio-container { --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }"
36
+ keys = ["body_background_fill", "body_text_color", "body_text_color_subdued", "background_fill_primary", "background_fill_secondary",
37
+ "block_background_fill", "input_background_fill", "border_color_primary", "block_border_color", "input_border_color",
38
+ "input_border_color_focus", "border_color_accent_subdued", "color_accent_soft", "link_text_color", "block_label_text_color",
39
+ "button_primary_background_fill", "button_secondary_background_fill", "button_primary_background_fill_hover",
40
+ "button_secondary_background_fill_hover", "button_primary_text_color", "button_secondary_text_color"]
41
+ # light: the site's white / light-blue / black embeds; dark: black with white text and blue accents
42
+ light = ["#ffffff", "#000000", "#5b7fa6", "#ffffff", "#f6f9fc", "#ffffff", "#ffffff", "#c9dcee", "#c9dcee", "#c9dcee",
43
+ "#0466C8", "#c9dcee", "#eaf4fd", "#0466C8", "#0466C8", "#0466C8", "#0466C8", "#2f9ce8", "#2f9ce8", "#ffffff", "#ffffff"]
44
+ dark = ["#000000", "#ffffff", "#8fb8e0", "#000000", "#0a1420", "#000000", "#0a1420", "#1f3b5c", "#1f3b5c", "#1f3b5c",
45
+ "#5aa4e8", "#1f3b5c", "#0b2a4a", "#5aa4e8", "#5aa4e8", "#0466C8", "#0466C8", "#2f9ce8", "#2f9ce8", "#ffffff", "#ffffff"]
46
+ theme = gr.themes.Base().set(**dict(zip(keys, light)), **{k + "_dark": v for k, v in zip(keys, dark)}, color_accent="#0466C8",
47
  block_radius="8px", input_radius="6px", button_large_radius="6px", button_small_radius="6px")
48
 
49
  gr.ChatInterface(respond, title="Eco", description="Questions about nature, climate and the environment.").launch(theme=theme, css=css)