shivi commited on
Commit
196b397
·
1 Parent(s): 32a5aa4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -6
app.py CHANGED
@@ -13,7 +13,7 @@ from gradio.themes import Soft
13
  from gradio.themes.utils import colors, fonts, sizes
14
 
15
 
16
- class SoftTheme(Soft):
17
  def __init__(
18
  self,
19
  *,
@@ -22,7 +22,7 @@ class SoftTheme(Soft):
22
  neutral_hue: colors.Color | str = colors.zinc,
23
  spacing_size: sizes.Size | str = sizes.spacing_md,
24
  radius_size: sizes.Size | str = sizes.radius_md,
25
- text_size: sizes.Size | str = sizes.text_lg,
26
  ):
27
  super().__init__(
28
  primary_hue=primary_hue,
@@ -32,17 +32,77 @@ class SoftTheme(Soft):
32
  radius_size=radius_size,
33
  text_size=text_size,
34
  )
 
35
  super().set(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
37
  button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
38
  button_primary_text_color="white",
39
  button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
40
- block_shadow="*shadow_drop_lg",
41
- button_shadow="*shadow_drop_lg",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  )
43
 
44
 
45
- softheme = SoftTheme()
46
 
47
 
48
  max_search_results = 3
@@ -62,7 +122,7 @@ def legal_doc_qa_bot(input_document, history):
62
  return history
63
 
64
 
65
- with gr.Blocks(theme=softheme) as demo:
66
  gr.HTML(
67
  """<html><center><img src='file/logo/flc_design4.png', alt='Legal-ease logo', width=250, height=250 /></center><br></html>"""
68
  )
 
13
  from gradio.themes.utils import colors, fonts, sizes
14
 
15
 
16
+ class CustomTheme(Base):
17
  def __init__(
18
  self,
19
  *,
 
22
  neutral_hue: colors.Color | str = colors.zinc,
23
  spacing_size: sizes.Size | str = sizes.spacing_md,
24
  radius_size: sizes.Size | str = sizes.radius_md,
25
+ text_size: sizes.Size | str = sizes.text_md,
26
  ):
27
  super().__init__(
28
  primary_hue=primary_hue,
 
32
  radius_size=radius_size,
33
  text_size=text_size,
34
  )
35
+ self.name = "soft"
36
  super().set(
37
+ # Colors
38
+ background_fill_primary="*neutral_50",
39
+ slider_color="*primary_500",
40
+ slider_color_dark="*primary_600",
41
+ # Shadows
42
+ shadow_drop="0 1px 4px 0 rgb(0 0 0 / 0.1)",
43
+ shadow_drop_lg="0 2px 5px 0 rgb(0 0 0 / 0.1)",
44
+ # Block Labels
45
+ block_background_fill="white",
46
+ block_label_padding="*spacing_sm *spacing_md",
47
+ block_label_background_fill="*primary_100",
48
+ block_label_background_fill_dark="*primary_600",
49
+ block_label_radius="*radius_md",
50
+ block_label_text_size="*text_md",
51
+ block_label_text_weight="600",
52
+ block_label_text_color="*primary_500",
53
+ block_label_text_color_dark="*white",
54
+ block_title_radius="*block_label_radius",
55
+ block_title_padding="*block_label_padding",
56
+ block_title_background_fill="*block_label_background_fill",
57
+ block_title_text_weight="600",
58
+ block_title_text_color="*primary_500",
59
+ block_title_text_color_dark="*white",
60
+ block_label_margin="*spacing_md",
61
+ block_shadow="*shadow_drop_lg",
62
+ # Inputs
63
+ input_border_color="*neutral_50",
64
+ input_shadow="*shadow_drop",
65
+ input_shadow_focus="*shadow_drop_lg",
66
+ checkbox_shadow="none",
67
+ # Buttons
68
+ shadow_spread="6px",
69
+ button_shadow="*shadow_drop_lg",
70
+ button_shadow_hover="*shadow_drop_lg",
71
+ button_shadow_active="*shadow_inset",
72
  button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
73
  button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
74
  button_primary_text_color="white",
75
  button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
76
+ button_primary_background_fill_hover_dark="*primary_500",
77
+ button_secondary_background_fill="white",
78
+ button_secondary_background_fill_hover="*neutral_100",
79
+ button_secondary_background_fill_hover_dark="*primary_500",
80
+ button_secondary_text_color="*neutral_800",
81
+ button_cancel_background_fill="*button_secondary_background_fill",
82
+ button_cancel_background_fill_hover="*button_secondary_background_fill_hover",
83
+ button_cancel_background_fill_hover_dark="*button_secondary_background_fill_hover",
84
+ button_cancel_text_color="*button_secondary_text_color",
85
+ #checkboxes
86
+ checkbox_label_shadow="*shadow_drop_lg",
87
+ checkbox_label_background_fill_selected="*primary_500",
88
+ checkbox_label_background_fill_selected_dark="*primary_600",
89
+ checkbox_border_width="1px",
90
+ checkbox_border_color="*neutral_100",
91
+ checkbox_border_color_dark="*neutral_600",
92
+ checkbox_background_color_selected="*primary_600",
93
+ checkbox_background_color_selected_dark="*primary_700",
94
+ checkbox_border_color_focus="*primary_500",
95
+ checkbox_border_color_focus_dark="*primary_600",
96
+ checkbox_border_color_selected="*primary_600",
97
+ checkbox_border_color_selected_dark="*primary_700",
98
+ checkbox_label_text_color_selected="white",
99
+ # Borders
100
+ block_border_width="0px",
101
+ panel_border_width="1px",
102
  )
103
 
104
 
105
+ custom_soft_theme = CustomTheme()
106
 
107
 
108
  max_search_results = 3
 
122
  return history
123
 
124
 
125
+ with gr.Blocks(theme=custom_theme) as demo:
126
  gr.HTML(
127
  """<html><center><img src='file/logo/flc_design4.png', alt='Legal-ease logo', width=250, height=250 /></center><br></html>"""
128
  )