reichaves commited on
Commit
57bdbe2
·
unverified ·
1 Parent(s): 711c453

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +135 -122
app.py CHANGED
@@ -170,191 +170,202 @@ def init_page_config():
170
 
171
  def apply_custom_css():
172
  """
173
- Aplica estilos CSS modernos e profissionais à interface
174
- Utiliza um esquema de cores consistente e design contemporâneo
175
  """
176
  st.markdown("""
177
  <style>
178
- /* Variáveis CSS para tema consistente */
179
- :root {
180
- --primary-color: #2D7FF9; /* Azul principal */
181
- --secondary-color: #06D6A0; /* Verde água para acentos */
182
- --background-main: #111827; /* Fundo principal escuro */
183
- --background-light: #1F2937; /* Fundo secundário */
184
- --text-primary: #F9FAFB; /* Texto principal */
185
- --text-secondary: #D1D5DB; /* Texto secundário */
186
- --accent-color: #818CF8; /* Cor de destaque */
187
- --error-color: #EF4444; /* Vermelho para erros */
188
- --success-color: #10B981; /* Verde para sucesso */
189
  }
190
 
191
- /* Reset e estilos base */
192
- .stApp {
193
- background-color: var(--background-main);
194
- color: var(--text-primary);
 
 
195
  }
196
 
197
- /* Título principal e cabeçalhos */
198
- .main-title {
199
- background: linear-gradient(120deg, var(--primary-color), var(--secondary-color));
200
- -webkit-background-clip: text;
201
- -webkit-text-fill-color: transparent;
202
- font-size: 2.5em;
203
- font-weight: 800;
204
- margin-bottom: 1.5rem;
205
- padding: 0.5rem 0;
206
  }
207
 
208
- h1, h2, h3 {
209
- color: var(--text-primary);
210
- font-weight: 600;
 
 
 
 
 
211
  }
212
 
213
- /* Container do Chat */
 
 
 
 
214
  .chat-message {
215
- padding: 1.25rem;
216
- border-radius: 0.75rem;
217
  margin-bottom: 1rem;
218
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
219
- border: 1px solid rgba(255, 255, 255, 0.1);
220
- background-color: var(--background-light);
221
  }
222
 
223
- /* Mensagens do usuário vs assistente */
224
  .user-message {
225
- background: linear-gradient(145deg, #1a237e15, #1a237e25);
226
- border-left: 4px solid var(--primary-color);
227
  }
228
 
229
  .assistant-message {
230
- background: linear-gradient(145deg, #00695c15, #00695c25);
231
- border-left: 4px solid var(--secondary-color);
232
  }
233
 
234
- /* Cabeçalho das mensagens */
235
  .chat-header {
 
236
  font-weight: 600;
237
- color: var(--text-primary);
238
- margin-bottom: 0.75rem;
239
- font-size: 1.1em;
240
  }
241
 
242
- /* Conteúdo das mensagens */
243
  .chat-content {
244
- color: var(--text-secondary);
245
- line-height: 1.6;
246
- font-size: 1em;
247
  }
248
 
249
- .chat-content em {
250
- display: block;
251
- margin-top: 1rem;
252
- padding-top: 0.75rem;
253
- border-top: 1px solid rgba(255, 255, 255, 0.1);
254
- color: var(--text-secondary);
255
- font-style: italic;
256
  }
257
 
258
- /* Botões e Interações */
259
- .stButton > button {
260
- background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
261
- color: white;
262
- border: none;
263
- border-radius: 8px;
264
- padding: 0.5rem 1.5rem;
265
- font-weight: 600;
266
- transition: all 0.3s ease;
267
- }
268
-
269
- .stButton > button:hover {
270
- opacity: 0.9;
271
- transform: translateY(-1px);
272
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
273
  }
274
 
275
- /* Campos de entrada */
276
  .stTextInput > div > div > input {
277
- background-color: var(--background-light);
278
- color: var(--text-primary);
279
- border: 1px solid rgba(255, 255, 255, 0.1);
280
- border-radius: 8px;
281
- padding: 0.75rem;
282
- transition: all 0.3s ease;
283
  }
284
 
285
  .stTextInput > div > div > input:focus {
286
- border-color: var(--primary-color);
287
- box-shadow: 0 0 0 2px rgba(45, 127, 249, 0.2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  }
289
 
290
- /* Upload de arquivos */
291
  .stUploadedFileData {
292
- background-color: var(--background-light) !important;
293
- color: var(--text-primary) !important;
294
- border-radius: 8px;
295
- padding: 1rem;
296
- border: 1px solid rgba(255, 255, 255, 0.1);
297
  }
298
 
299
- /* Barra de progresso */
300
  .stProgress > div > div > div > div {
301
- background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
302
  }
303
 
304
- /* Alertas e mensagens */
305
  .stAlert {
306
- background-color: var(--background-light);
307
- color: var(--text-primary);
308
- border: 1px solid rgba(255, 255, 255, 0.1);
309
- border-radius: 8px;
310
  padding: 1rem;
 
311
  }
312
 
313
- /* Info icon e tooltips */
314
  .stTooltipIcon {
315
- color: var(--primary-color) !important;
316
  }
317
 
318
- /* Efeitos de hover em links */
319
- a {
320
- color: var(--primary-color);
321
- text-decoration: none;
322
- transition: all 0.2s ease;
 
 
323
  }
324
 
325
- a:hover {
326
- color: var(--secondary-color);
327
- text-decoration: underline;
 
328
  }
329
 
330
- /* Token info */
331
- .token-info {
332
- color: var(--text-secondary);
333
- font-size: 0.9em;
334
- margin-top: 1rem;
335
- padding-top: 0.75rem;
336
- border-top: 1px solid rgba(255, 255, 255, 0.1);
337
  }
338
 
339
- /* Removendo elementos desnecessários */
340
- div[data-testid="stToolbar"], .stDeployButton {
341
- display: none;
342
  }
343
 
344
- /* Ajustes gerais de espaçamento e alinhamento */
345
- .stMarkdown {
346
- line-height: 1.6;
347
  }
348
 
349
- /* Ajustes para telas menores */
350
- @media (max-width: 768px) {
351
- .main-title {
352
- font-size: 2em;
353
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
 
 
355
  .chat-message {
356
  padding: 1rem;
357
  }
 
 
 
 
358
  }
359
  </style>
360
  """, unsafe_allow_html=True)
@@ -611,8 +622,10 @@ def main():
611
  apply_custom_css()
612
  create_sidebar()
613
 
614
- # Título principal
615
- st.markdown('<h1 class="main-title">Chatbot com modelo de IA especializado em Português do Brasil - entrevista PDFs 📚</h1>', unsafe_allow_html=True)
 
 
616
 
617
  # Campos de API em duas colunas
618
  col1, col2 = st.columns(2)
 
170
 
171
  def apply_custom_css():
172
  """
173
+ Aplica estilos CSS personalizados à interface.
174
+ Compatível com Streamlit e HuggingFace.
175
  """
176
  st.markdown("""
177
  <style>
178
+ /* Base */
179
+ .stApp {
180
+ max-width: 100%;
181
+ padding-top: 2rem;
182
+ background-color: #0e1117;
 
 
 
 
 
 
183
  }
184
 
185
+ /* Headers */
186
+ h1 {
187
+ color: #ff8c00 !important;
188
+ font-size: 32px !important;
189
+ font-weight: 600 !important;
190
+ padding: 0.5rem 0 !important;
191
  }
192
 
193
+ h2, h3 {
194
+ color: #fafafa !important;
195
+ padding: 0.5rem 0 !important;
 
 
 
 
 
 
196
  }
197
 
198
+ /* Text and Links */
199
+ p, li {
200
+ color: #fafafa;
201
+ }
202
+
203
+ a {
204
+ color: #4c8bf5 !important;
205
+ text-decoration: none;
206
  }
207
 
208
+ a:hover {
209
+ text-decoration: underline;
210
+ }
211
+
212
+ /* Chat Messages */
213
  .chat-message {
214
+ padding: 1.5rem;
215
+ border-radius: 0.5rem;
216
  margin-bottom: 1rem;
217
+ display: flex;
218
+ flex-direction: column;
219
+ background-color: #1a1c23;
220
  }
221
 
 
222
  .user-message {
223
+ border-left: 4px solid #4c8bf5;
 
224
  }
225
 
226
  .assistant-message {
227
+ border-left: 4px solid #00cc89;
 
228
  }
229
 
 
230
  .chat-header {
231
+ color: #fafafa;
232
  font-weight: 600;
233
+ margin-bottom: 0.5rem;
234
+ font-size: 1rem;
 
235
  }
236
 
 
237
  .chat-content {
238
+ color: #fafafa;
239
+ line-height: 1.5;
240
+ margin-left: 0.5rem;
241
  }
242
 
243
+ /* Code Blocks */
244
+ code {
245
+ background-color: #262730;
246
+ padding: 0.2em 0.4em;
247
+ border-radius: 3px;
248
+ font-size: 85%;
249
+ color: #ff8c00;
250
  }
251
 
252
+ pre {
253
+ background-color: #262730;
254
+ padding: 1rem;
255
+ border-radius: 5px;
256
+ overflow-x: auto;
 
 
 
 
 
 
 
 
 
 
257
  }
258
 
259
+ /* Input Elements */
260
  .stTextInput > div > div > input {
261
+ background-color: #262730;
262
+ color: #fafafa;
263
+ border: 1px solid #4c4c4c;
 
 
 
264
  }
265
 
266
  .stTextInput > div > div > input:focus {
267
+ border-color: #4c8bf5;
268
+ box-shadow: 0 0 0 1px #4c8bf5;
269
+ }
270
+
271
+ /* Buttons */
272
+ .stButton > button {
273
+ background-color: #262730;
274
+ color: #4c8bf5;
275
+ border: 1px solid #4c8bf5;
276
+ padding: 0.5rem 1rem;
277
+ border-radius: 0.5rem;
278
+ font-weight: 600;
279
+ transition: all 0.2s ease;
280
+ }
281
+
282
+ .stButton > button:hover {
283
+ background-color: #4c8bf5;
284
+ color: #ffffff;
285
  }
286
 
287
+ /* File Uploader */
288
  .stUploadedFileData {
289
+ background-color: #262730 !important;
290
+ color: #fafafa !important;
291
+ padding: 1rem !important;
292
+ border-radius: 0.5rem !important;
 
293
  }
294
 
295
+ /* Progress Bar */
296
  .stProgress > div > div > div > div {
297
+ background-color: #4c8bf5;
298
  }
299
 
300
+ /* Alerts and Messages */
301
  .stAlert {
302
+ background-color: #262730;
303
+ color: #fafafa;
 
 
304
  padding: 1rem;
305
+ border-radius: 0.5rem;
306
  }
307
 
308
+ /* Info icon */
309
  .stTooltipIcon {
310
+ color: #4c8bf5 !important;
311
  }
312
 
313
+ /* Token Information */
314
+ .token-info {
315
+ color: #808080;
316
+ font-size: 0.9rem;
317
+ margin-top: 0.5rem;
318
+ padding-top: 0.5rem;
319
+ border-top: 1px solid #4c4c4c;
320
  }
321
 
322
+ /* Hide elements */
323
+ div[data-testid="stToolbar"],
324
+ .stDeployButton {
325
+ display: none;
326
  }
327
 
328
+ /* Success/Warning/Error Colors */
329
+ .success {
330
+ color: #00cc89;
 
 
 
 
331
  }
332
 
333
+ .warning {
334
+ color: #ff8c00;
 
335
  }
336
 
337
+ .error {
338
+ color: #ff4c4c;
 
339
  }
340
 
341
+ /* Scrollbars */
342
+ ::-webkit-scrollbar {
343
+ width: 8px;
344
+ height: 8px;
345
+ }
346
+
347
+ ::-webkit-scrollbar-track {
348
+ background: #1a1c23;
349
+ }
350
+
351
+ ::-webkit-scrollbar-thumb {
352
+ background: #4c4c4c;
353
+ border-radius: 4px;
354
+ }
355
+
356
+ ::-webkit-scrollbar-thumb:hover {
357
+ background: #666666;
358
+ }
359
 
360
+ /* Mobile Responsiveness */
361
+ @media (max-width: 768px) {
362
  .chat-message {
363
  padding: 1rem;
364
  }
365
+
366
+ h1 {
367
+ font-size: 24px !important;
368
+ }
369
  }
370
  </style>
371
  """, unsafe_allow_html=True)
 
622
  apply_custom_css()
623
  create_sidebar()
624
 
625
+ # Título principal - Nova implementação
626
+ st.markdown("""
627
+ # 📚 Chatbot com modelo de IA especializado em Português do Brasil - entrevista PDFs
628
+ """)
629
 
630
  # Campos de API em duas colunas
631
  col1, col2 = st.columns(2)