Migue1804 commited on
Commit
c5a78d1
verified
1 Parent(s): e146b03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +72 -27
app.py CHANGED
@@ -8,23 +8,13 @@ from typing import List, Dict
8
  st.set_page_config(
9
  page_title="Biblioteca de Res煤menes de Libros",
10
  layout="wide",
11
- initial_sidebar_state="expanded"
 
12
  )
13
 
14
  # Display the image above the title
15
  st.image('Bookbot.png', use_container_width=True)
16
 
17
- st.markdown("""
18
- <style>
19
- :root {
20
- --background-color: #ffffff;
21
- --secondary-background-color: #f0f2f6;
22
- --primary-color: #ff4b4b;
23
- --text-color: #31333F;
24
- }
25
- </style>
26
- """, unsafe_allow_html=True)
27
-
28
  # Funci贸n para cargar imagen y codificarla en base64
29
  def get_image_base64(image_path):
30
  """Carga una imagen y la convierte a base64 para mostrarla"""
@@ -35,18 +25,32 @@ def get_image_base64(image_path):
35
  return None
36
 
37
  # CSS personalizado para un dise帽o moderno y minimalista
 
 
38
  def apply_custom_css():
39
  st.markdown("""
40
  <style>
 
 
 
 
 
 
 
 
 
 
 
 
41
  /* Estilos generales */
42
  .main {
43
  padding: 2rem 3rem;
44
- background-color: #f8f9fa;
45
  }
46
 
47
  /* T铆tulo principal */
48
  .main h1 {
49
- color: #1E3A8A;
50
  font-size: 2.5rem;
51
  font-weight: 600;
52
  margin-bottom: 2rem;
@@ -54,13 +58,13 @@ def apply_custom_css():
54
 
55
  /* Subt铆tulos */
56
  .main h2, .main h3 {
57
- color: #1E3A8A;
58
  font-weight: 500;
59
  }
60
 
61
  /* Contenedor de chat */
62
  .chat-container {
63
- background-color: white;
64
  border-radius: 8px;
65
  padding: 20px;
66
  margin-top: 20px;
@@ -69,35 +73,39 @@ def apply_custom_css():
69
 
70
  /* Mensajes del usuario */
71
  .user-message {
72
- background-color: #E7F3FF;
73
  border-radius: 15px 15px 0 15px;
74
  padding: 10px 15px;
75
  margin: 10px 0;
76
  max-width: 80%;
77
  align-self: flex-end;
78
  margin-left: auto;
 
79
  }
80
 
81
  /* Mensajes del asistente */
82
  .assistant-message {
83
- background-color: #F0F0F0;
84
  border-radius: 15px 15px 15px 0;
85
  padding: 10px 15px;
86
  margin: 10px 0;
87
  max-width: 80%;
 
88
  }
89
 
90
  /* Campo de entrada de texto */
91
  .stTextInput input {
92
  border-radius: 20px;
93
- border: 1px solid #E0E0E0;
94
  padding: 10px 15px;
95
  font-size: 1rem;
 
 
96
  }
97
 
98
  /* Tarjeta del libro */
99
  .book-card {
100
- background-color: white;
101
  border-radius: 8px;
102
  padding: 15px;
103
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
@@ -115,13 +123,13 @@ def apply_custom_css():
115
  hr {
116
  margin: 1.5rem 0;
117
  border: 0;
118
- border-top: 1px solid #E0E0E0;
119
  }
120
 
121
  /* Bot贸n de env铆o */
122
  .stButton button {
123
- background-color: #1E3A8A;
124
- color: white;
125
  border-radius: 20px;
126
  padding: 5px 20px;
127
  font-weight: 500;
@@ -130,26 +138,63 @@ def apply_custom_css():
130
  }
131
 
132
  .stButton button:hover {
133
- background-color: #2563EB;
134
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
135
  }
136
 
137
  /* Sidebar */
138
  .sidebar .sidebar-content {
139
- background-color: #F8F9FA;
140
  padding: 20px;
141
  }
142
 
143
  /* T铆tulo del sidebar */
144
  .sidebar h2 {
145
- color: #1E3A8A;
146
  font-size: 1.5rem;
147
  font-weight: 500;
148
  margin-bottom: 1rem;
149
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  </style>
151
  """, unsafe_allow_html=True)
152
-
153
  # Funci贸n para cargar res煤menes de libros desde archivos de texto
154
  def cargar_resumenes_libros(carpeta_libros: str) -> List[Dict[str, str]]:
155
  """
 
8
  st.set_page_config(
9
  page_title="Biblioteca de Res煤menes de Libros",
10
  layout="wide",
11
+ initial_sidebar_state="expanded",
12
+ theme="light"
13
  )
14
 
15
  # Display the image above the title
16
  st.image('Bookbot.png', use_container_width=True)
17
 
 
 
 
 
 
 
 
 
 
 
 
18
  # Funci贸n para cargar imagen y codificarla en base64
19
  def get_image_base64(image_path):
20
  """Carga una imagen y la convierte a base64 para mostrarla"""
 
25
  return None
26
 
27
  # CSS personalizado para un dise帽o moderno y minimalista
28
+ # Modifica la funci贸n apply_custom_css() para forzar el modo claro
29
+
30
  def apply_custom_css():
31
  st.markdown("""
32
  <style>
33
+ /* Forzar modo claro */
34
+ html, body, [data-testid="stAppViewContainer"], [data-testid="stSidebar"],
35
+ [data-testid="stHeader"], [data-testid="stToolbar"] {
36
+ background-color: white !important;
37
+ color: #31333F !important;
38
+ }
39
+
40
+ /* Deshabilitar el interruptor de tema oscuro/claro */
41
+ .css-1b0udgb {
42
+ display: none !important;
43
+ }
44
+
45
  /* Estilos generales */
46
  .main {
47
  padding: 2rem 3rem;
48
+ background-color: #f8f9fa !important;
49
  }
50
 
51
  /* T铆tulo principal */
52
  .main h1 {
53
+ color: #1E3A8A !important;
54
  font-size: 2.5rem;
55
  font-weight: 600;
56
  margin-bottom: 2rem;
 
58
 
59
  /* Subt铆tulos */
60
  .main h2, .main h3 {
61
+ color: #1E3A8A !important;
62
  font-weight: 500;
63
  }
64
 
65
  /* Contenedor de chat */
66
  .chat-container {
67
+ background-color: white !important;
68
  border-radius: 8px;
69
  padding: 20px;
70
  margin-top: 20px;
 
73
 
74
  /* Mensajes del usuario */
75
  .user-message {
76
+ background-color: #E7F3FF !important;
77
  border-radius: 15px 15px 0 15px;
78
  padding: 10px 15px;
79
  margin: 10px 0;
80
  max-width: 80%;
81
  align-self: flex-end;
82
  margin-left: auto;
83
+ color: #31333F !important;
84
  }
85
 
86
  /* Mensajes del asistente */
87
  .assistant-message {
88
+ background-color: #F0F0F0 !important;
89
  border-radius: 15px 15px 15px 0;
90
  padding: 10px 15px;
91
  margin: 10px 0;
92
  max-width: 80%;
93
+ color: #31333F !important;
94
  }
95
 
96
  /* Campo de entrada de texto */
97
  .stTextInput input {
98
  border-radius: 20px;
99
+ border: 1px solid #E0E0E0 !important;
100
  padding: 10px 15px;
101
  font-size: 1rem;
102
+ background-color: white !important;
103
+ color: #31333F !important;
104
  }
105
 
106
  /* Tarjeta del libro */
107
  .book-card {
108
+ background-color: white !important;
109
  border-radius: 8px;
110
  padding: 15px;
111
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
 
123
  hr {
124
  margin: 1.5rem 0;
125
  border: 0;
126
+ border-top: 1px solid #E0E0E0 !important;
127
  }
128
 
129
  /* Bot贸n de env铆o */
130
  .stButton button {
131
+ background-color: #1E3A8A !important;
132
+ color: white !important;
133
  border-radius: 20px;
134
  padding: 5px 20px;
135
  font-weight: 500;
 
138
  }
139
 
140
  .stButton button:hover {
141
+ background-color: #2563EB !important;
142
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
143
  }
144
 
145
  /* Sidebar */
146
  .sidebar .sidebar-content {
147
+ background-color: #F8F9FA !important;
148
  padding: 20px;
149
  }
150
 
151
  /* T铆tulo del sidebar */
152
  .sidebar h2 {
153
+ color: #1E3A8A !important;
154
  font-size: 1.5rem;
155
  font-weight: 500;
156
  margin-bottom: 1rem;
157
  }
158
+
159
+ /* Ajustes adicionales para modo claro forzado */
160
+ [data-testid="stSidebar"] {
161
+ background-color: #F8F9FA !important;
162
+ }
163
+
164
+ .stSelectbox label, .stTextInput label {
165
+ color: #31333F !important;
166
+ }
167
+
168
+ .stMarkdown p, .stMarkdown div {
169
+ color: #31333F !important;
170
+ }
171
+
172
+ /* Selectbox */
173
+ div[data-baseweb="select"] {
174
+ background-color: white !important;
175
+ }
176
+
177
+ div[data-baseweb="select"] > div {
178
+ background-color: white !important;
179
+ color: #31333F !important;
180
+ }
181
+
182
+ div[role="listbox"] {
183
+ background-color: white !important;
184
+ }
185
+
186
+ div[role="option"] {
187
+ background-color: white !important;
188
+ color: #31333F !important;
189
+ }
190
+
191
+ /* Spinner */
192
+ .stSpinner > div {
193
+ border-color: #1E3A8A !important;
194
+ }
195
  </style>
196
  """, unsafe_allow_html=True)
197
+
198
  # Funci贸n para cargar res煤menes de libros desde archivos de texto
199
  def cargar_resumenes_libros(carpeta_libros: str) -> List[Dict[str, str]]:
200
  """