DavidBazaldua commited on
Commit
b2d12f0
·
verified ·
1 Parent(s): 6e36cce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -40
app.py CHANGED
@@ -79,7 +79,7 @@ def chat_logic(message, history, system_prompt, context, max_tokens, temperature
79
  return "", history
80
 
81
  # ==========================================
82
- # 3. UI DESIGN (FINAL ENGLISH VERSION)
83
  # ==========================================
84
 
85
  CSS = """
@@ -95,7 +95,7 @@ CSS = """
95
  --block-border-color: transparent !important;
96
  --input-background-fill: #ffffff !important;
97
 
98
- /* KILL PURPLE/BLUE COLORS */
99
  --primary-500: #000000 !important;
100
  --primary-600: #000000 !important;
101
  --secondary-500: #000000 !important;
@@ -109,6 +109,11 @@ body {
109
  min-height: 100vh;
110
  }
111
 
 
 
 
 
 
112
  h1 { font-weight: 700 !important; color: #000000 !important; letter-spacing: -0.02em; }
113
  p, span, label { color: #374151 !important; }
114
 
@@ -129,7 +134,7 @@ p, span, label { color: #374151 !important; }
129
  box-shadow: none !important;
130
  }
131
 
132
- /* Labels: Black Text */
133
  .config-card label span,
134
  .config-card .label-wrap span,
135
  .config-card .block-title {
@@ -143,7 +148,7 @@ p, span, label { color: #374151 !important; }
143
  padding: 0 !important;
144
  }
145
 
146
- /* Inputs: White Background */
147
  .config-card textarea,
148
  .config-card input[type="text"],
149
  .config-card input[type="number"] {
@@ -154,7 +159,7 @@ p, span, label { color: #374151 !important; }
154
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
155
  }
156
 
157
- /* Sliders: Black */
158
  input[type=range] {
159
  accent-color: #000000 !important;
160
  filter: grayscale(100%) brightness(0) !important;
@@ -187,20 +192,16 @@ input[type=range] {
187
  }
188
 
189
  /* --- CHAT BUBBLES --- */
190
-
191
- /* User: Black Background + WHITE TEXT */
192
  .message.user {
193
  background-color: #000000 !important;
194
- color: #ffffff !important; /* FORCED WHITE TEXT */
195
  border-radius: 18px 18px 4px 18px !important;
196
  font-weight: 500;
197
  }
198
- /* Ensure inner text elements are white */
199
  .message.user p, .message.user span, .message.user div {
200
  color: #ffffff !important;
201
  }
202
 
203
- /* Bot: White Background + Black Text */
204
  .message.bot {
205
  background-color: #ffffff !important;
206
  color: #000000 !important;
@@ -209,7 +210,7 @@ input[type=range] {
209
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
210
  }
211
 
212
- /* --- INPUT BOX WITH SCROLLBAR ("SLICER") --- */
213
  .chat-input-area {
214
  padding: 16px 24px 24px 24px;
215
  display: flex; gap: 10px; align-items: flex-end;
@@ -220,14 +221,11 @@ input[type=range] {
220
  padding: 12px 18px !important;
221
  border: 1px solid #e5e7eb !important;
222
  color: #000000 !important;
223
-
224
- /* SCROLLBAR MAGIC */
225
- max-height: 120px !important; /* Max height before scrolling */
226
- overflow-y: auto !important; /* Enable scrollbar */
227
  border-radius: 24px !important;
228
  }
229
 
230
- /* Send Arrow Button */
231
  #send-btn {
232
  background: transparent !important;
233
  color: #000000 !important;
@@ -242,13 +240,6 @@ input[type=range] {
242
  transform: translateX(3px);
243
  color: #333;
244
  }
245
-
246
- /* Logos */
247
- .trusted-logos {
248
- opacity: 0.6; filter: grayscale(100%);
249
- margin-top: 30px; display: flex; gap: 20px;
250
- font-weight: 600; font-size: 1.1rem; color: #4b5563;
251
- }
252
  """
253
 
254
  WINDOW_HEADER = """
@@ -260,18 +251,6 @@ WINDOW_HEADER = """
260
  </div>
261
  """
262
 
263
- TRUSTED_SECTION = """
264
- <div style="margin-top: 40px;">
265
- <p style="font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #9ca3af; margin-bottom: 10px;">Trusted by</p>
266
- <div class="trusted-logos">
267
- <span>Pingdom</span>
268
- <span>prismic</span>
269
- <span>Unsplash</span>
270
- <span>krisp</span>
271
- </div>
272
- </div>
273
- """
274
-
275
  with gr.Blocks(theme=gr.themes.Soft(), css=CSS, title="Custom AI") as demo:
276
 
277
  with gr.Row(elem_id="main-container"):
@@ -280,13 +259,15 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, title="Custom AI") as demo:
280
  with gr.Column(scale=4):
281
  gr.Markdown(
282
  """
283
- # MX Iris AI Chatbot
 
284
 
 
285
  """
286
  )
287
 
288
  with gr.Group(elem_classes="config-card"):
289
- gr.Markdown("### Settings")
290
 
291
  context_input = gr.Textbox(
292
  label="Context (Data)",
@@ -305,8 +286,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, title="Custom AI") as demo:
305
  tokens_slider = gr.Slider(64, 1024, value=256, step=64, label="Max Tokens")
306
 
307
  top_p_slider = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-P")
308
-
309
- gr.HTML(TRUSTED_SECTION)
310
 
311
  # --- RIGHT PANEL ---
312
  with gr.Column(scale=6):
@@ -338,4 +319,4 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS, title="Custom AI") as demo:
338
  send_btn.click(chat_logic, inputs_list, [msg, chatbot])
339
 
340
  if __name__ == "__main__":
341
- demo.launch()
 
79
  return "", history
80
 
81
  # ==========================================
82
+ # 3. UI DESIGN (CLEANEST VERSION)
83
  # ==========================================
84
 
85
  CSS = """
 
95
  --block-border-color: transparent !important;
96
  --input-background-fill: #ffffff !important;
97
 
98
+ /* COLORS */
99
  --primary-500: #000000 !important;
100
  --primary-600: #000000 !important;
101
  --secondary-500: #000000 !important;
 
109
  min-height: 100vh;
110
  }
111
 
112
+ /* HIDE GRADIO FOOTER (The buttons at the bottom) */
113
+ footer {
114
+ display: none !important;
115
+ }
116
+
117
  h1 { font-weight: 700 !important; color: #000000 !important; letter-spacing: -0.02em; }
118
  p, span, label { color: #374151 !important; }
119
 
 
134
  box-shadow: none !important;
135
  }
136
 
137
+ /* Labels */
138
  .config-card label span,
139
  .config-card .label-wrap span,
140
  .config-card .block-title {
 
148
  padding: 0 !important;
149
  }
150
 
151
+ /* Inputs */
152
  .config-card textarea,
153
  .config-card input[type="text"],
154
  .config-card input[type="number"] {
 
159
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
160
  }
161
 
162
+ /* Sliders */
163
  input[type=range] {
164
  accent-color: #000000 !important;
165
  filter: grayscale(100%) brightness(0) !important;
 
192
  }
193
 
194
  /* --- CHAT BUBBLES --- */
 
 
195
  .message.user {
196
  background-color: #000000 !important;
197
+ color: #ffffff !important;
198
  border-radius: 18px 18px 4px 18px !important;
199
  font-weight: 500;
200
  }
 
201
  .message.user p, .message.user span, .message.user div {
202
  color: #ffffff !important;
203
  }
204
 
 
205
  .message.bot {
206
  background-color: #ffffff !important;
207
  color: #000000 !important;
 
210
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
211
  }
212
 
213
+ /* --- INPUT BOX --- */
214
  .chat-input-area {
215
  padding: 16px 24px 24px 24px;
216
  display: flex; gap: 10px; align-items: flex-end;
 
221
  padding: 12px 18px !important;
222
  border: 1px solid #e5e7eb !important;
223
  color: #000000 !important;
224
+ max-height: 120px !important;
225
+ overflow-y: auto !important;
 
 
226
  border-radius: 24px !important;
227
  }
228
 
 
229
  #send-btn {
230
  background: transparent !important;
231
  color: #000000 !important;
 
240
  transform: translateX(3px);
241
  color: #333;
242
  }
 
 
 
 
 
 
 
243
  """
244
 
245
  WINDOW_HEADER = """
 
251
  </div>
252
  """
253
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  with gr.Blocks(theme=gr.themes.Soft(), css=CSS, title="Custom AI") as demo:
255
 
256
  with gr.Row(elem_id="main-container"):
 
259
  with gr.Column(scale=4):
260
  gr.Markdown(
261
  """
262
+ # Custom AI Chatbot
263
+ # trained on your data
264
 
265
+ Customize the behavior and context of your assistant right here.
266
  """
267
  )
268
 
269
  with gr.Group(elem_classes="config-card"):
270
+ gr.Markdown("### ⚙️ Settings")
271
 
272
  context_input = gr.Textbox(
273
  label="Context (Data)",
 
286
  tokens_slider = gr.Slider(64, 1024, value=256, step=64, label="Max Tokens")
287
 
288
  top_p_slider = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Top-P")
289
+
290
+ # (Trusted section removed)
291
 
292
  # --- RIGHT PANEL ---
293
  with gr.Column(scale=6):
 
319
  send_btn.click(chat_logic, inputs_list, [msg, chatbot])
320
 
321
  if __name__ == "__main__":
322
+ demo.launch(show_api=False, show_footer=False)