pratyushmaini commited on
Commit
33783bd
·
1 Parent(s): f53a587

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -140
app.py CHANGED
@@ -49,166 +49,57 @@ def respond(message, history, system_message, max_tokens, temperature, top_p, se
49
 
50
  # Custom CSS for branding with consistent styling and hiding footer
51
  css = """
52
- @import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;500;600;700&display=swap');
53
-
54
- body {
55
- background-color: #f0f5fb; /* Light pastel blue background */
56
- font-family: 'Crimson Pro', 'Palatino', serif;
57
- max-width: 100%;
58
- overflow-x: hidden;
59
- }
60
- .gradio-container {
61
- background-color: #FFFFFF;
62
- border-radius: 16px;
63
- box-shadow: 0 3px 10px rgba(0,0,0,0.05);
64
- max-width: 90%;
65
- margin: 10px auto;
66
- }
67
- .app-header {
68
- background: linear-gradient(135deg, #4a90e2, #75c6ef);
69
- padding: 15px;
70
- border-radius: 16px 16px 0 0;
71
- position: relative;
72
- color: white;
73
- overflow: hidden;
74
- border-bottom: 3px solid #e6c200;
75
  }
76
- .app-header::before {
77
- content: "🛡️";
78
- position: absolute;
79
- font-size: 100px;
80
- opacity: 0.1;
81
- right: -20px;
82
- top: -30px;
83
- transform: rotate(15deg);
84
- }
85
- .app-title {
86
- font-size: 24px;
87
- font-weight: 600;
88
- margin: 0;
89
- display: flex;
90
- align-items: center;
91
- font-family: 'Crimson Pro', serif;
92
- }
93
- .app-title .safe {
94
- font-weight: 700;
95
- margin-right: 5px;
96
- }
97
- .app-title .lm {
98
- font-weight: 400;
99
- letter-spacing: 1px;
100
- }
101
- .app-title .shield {
102
- margin-right: 10px;
103
- font-size: 22px;
104
- }
105
- .app-subtitle {
106
- font-size: 14px;
107
- opacity: 0.9;
108
- margin-top: 5px;
109
- }
110
- /* Send and Clear Chat buttons with gold accents */
111
- button[aria-label="Send"], button[aria-label="Clear Chat"] {
112
  background: white !important;
113
  color: #333 !important;
114
  border: 2px solid #e6c200 !important;
115
- border-radius: 8px !important;
116
- padding: 8px 16px !important;
117
- font-weight: 600 !important;
118
- transition: all 0.3s ease !important;
119
- font-family: 'Crimson Pro', serif !important;
120
  }
121
- button[aria-label="Send"]:hover, button[aria-label="Clear Chat"]:hover {
122
  background: #fff9e6 !important;
123
- transform: translateY(-1px) !important;
124
- box-shadow: 0 3px 6px rgba(230, 194, 0, 0.2) !important;
125
  }
126
- /* Other buttons remain with blue gradient */
127
- button:not([aria-label="Send"]):not([aria-label="Clear Chat"]), .gradio-button:not([aria-label="Send"]):not([aria-label="Clear Chat"]) {
128
- background: linear-gradient(to right, #4a90e2, #75c6ef) !important;
129
- color: white !important;
130
- border: none !important;
131
- border-radius: 8px !important;
132
- padding: 8px 16px !important;
133
- font-weight: 600 !important;
134
- transition: all 0.3s ease !important;
135
- font-family: 'Crimson Pro', serif !important;
136
- }
137
- button:not([aria-label="Send"]):not([aria-label="Clear Chat"]):hover, .gradio-button:not([aria-label="Send"]):not([aria-label="Clear Chat"]):hover {
138
- transform: translateY(-1px) !important;
139
- box-shadow: 0 3px 6px rgba(74, 144, 226, 0.2) !important;
140
  }
141
- .gradio-dropdown, .gradio-slider, .gradio-textbox, .gradio-checkbox {
142
- border-radius: 8px !important;
143
- border: 1px solid #e1e5eb !important;
144
- font-family: 'Crimson Pro', serif !important;
145
  }
146
- .model-select {
147
- border-left: 3px solid #e6c200 !important;
148
- padding-left: 8px !important;
149
  }
150
- /* Clean chat styling without background colors */
151
- .chatbot .user-message::before {
 
152
  content: "👤 ";
153
  font-size: 16px;
 
154
  }
155
- .chatbot .assistant-message::before {
156
  content: "🛡️ ";
157
  font-size: 16px;
 
158
  }
159
- .chatbot .user-message, .chatbot .assistant-message {
160
- background-color: transparent !important;
161
- border-radius: 0 !important;
162
- padding: 10px !important;
163
- border-bottom: 1px solid #f0f0f0 !important;
164
- font-family: 'Crimson Pro', serif !important;
165
- font-size: 16px !important;
166
- }
167
- /* Remove the blue background behind message text */
168
- .chatbot .user-message p, .chatbot .assistant-message p {
169
- background-color: transparent !important;
170
- }
171
- .chatbot .user-message {
172
- color: #333333 !important;
173
- }
174
- .chatbot .assistant-message {
175
- color: #1a73e8 !important;
176
- }
177
- #chatbot {
178
- height: 400px !important;
179
- overflow-y: auto !important;
180
- border: 1px solid #e1e5eb !important;
181
- border-radius: 8px !important;
182
- background-color: #ffffff !important;
183
- }
184
- /* Hide Gradio branding and footer */
185
- footer, .footer {
186
- display: none !important;
187
- }
188
- .gradio-footer {
189
- display: none !important;
190
- }
191
- .gradio-container .footer {
192
- display: none !important;
193
- }
194
- .gradio-container .footer-logo {
195
- display: none !important;
196
- }
197
- div.gradio-footer {
198
- display: none !important;
199
- }
200
- .footer-message {
201
- display: none !important;
202
- }
203
- button[aria-label="Use via API"] {
204
  display: none !important;
205
  }
 
206
 
207
 
208
 
209
- """
210
-
211
- with gr.Blocks(css=css) as demo:
 
 
212
  # Custom header with branding - removed the hr element
213
  gr.HTML("""
214
  <div class="app-header">
@@ -275,7 +166,7 @@ with gr.Blocks(css=css) as demo:
275
  )
276
 
277
  with gr.Row():
278
- clear_button = gr.Button("Clear Chat")
279
 
280
  # No footer - removed
281
  gr.HTML('<div style="height: 20px;"></div>')
 
49
 
50
  # Custom CSS for branding with consistent styling and hiding footer
51
  css = """
52
+ body {
53
+ background-color: #f0f5fb !important; /* Light pastel blue background */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
+
56
+ /* Gold button styling */
57
+ .gold-button {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  background: white !important;
59
  color: #333 !important;
60
  border: 2px solid #e6c200 !important;
 
 
 
 
 
61
  }
62
+ .gold-button:hover {
63
  background: #fff9e6 !important;
64
+ box-shadow: 0 2px 5px rgba(230, 194, 0, 0.2) !important;
 
65
  }
66
+
67
+ /* Message styling - no backgrounds */
68
+ .message {
69
+ background-color: transparent !important;
 
 
 
 
 
 
 
 
 
 
70
  }
71
+ .message p {
72
+ background-color: transparent !important;
 
 
73
  }
74
+ .message-wrap {
75
+ background-color: transparent !important;
 
76
  }
77
+
78
+ /* Emoji for messages */
79
+ .user .message::before {
80
  content: "👤 ";
81
  font-size: 16px;
82
+ margin-right: 5px;
83
  }
84
+ .bot .message::before {
85
  content: "🛡️ ";
86
  font-size: 16px;
87
+ margin-right: 5px;
88
  }
89
+
90
+ /* Hide footer */
91
+ footer {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  display: none !important;
93
  }
94
+ """
95
 
96
 
97
 
98
+ with gr.Blocks(theme=gr.themes.Default(
99
+ primary_hue="blue",
100
+ secondary_hue="gold",
101
+ font=["Crimson Pro", "Palatino", "serif"]
102
+ ), css=css) as demo:
103
  # Custom header with branding - removed the hr element
104
  gr.HTML("""
105
  <div class="app-header">
 
166
  )
167
 
168
  with gr.Row():
169
+ clear_button = gr.Button("Clear Chat", variant="secondary", elem_classes=["gold-button"])
170
 
171
  # No footer - removed
172
  gr.HTML('<div style="height: 20px;"></div>')