Update app.py
Browse files
app.py
CHANGED
@@ -10,131 +10,6 @@ st.set_page_config(page_title="🤖 Soph-IA", layout="wide")
|
|
10 |
|
11 |
api_key = st.secrets["API_KEY"]
|
12 |
|
13 |
-
# Estilo CSS adaptable a modo claro y oscuro
|
14 |
-
st.markdown("""
|
15 |
-
<style>
|
16 |
-
/* Estilos generales */
|
17 |
-
body {
|
18 |
-
font-family: 'Arial', sans-serif;
|
19 |
-
transition: background-color 0.3s, color 0.3s;
|
20 |
-
}
|
21 |
-
|
22 |
-
h1 {
|
23 |
-
text-align: center;
|
24 |
-
}
|
25 |
-
|
26 |
-
.response {
|
27 |
-
border-radius: 5px;
|
28 |
-
padding: 10px;
|
29 |
-
margin-top: 10px;
|
30 |
-
transition: background-color 0.3s, color 0.3s;
|
31 |
-
}
|
32 |
-
|
33 |
-
.footer {
|
34 |
-
text-align: center;
|
35 |
-
margin-top: 20px;
|
36 |
-
}
|
37 |
-
|
38 |
-
.audio-button {
|
39 |
-
border: none;
|
40 |
-
border-radius: 5px;
|
41 |
-
padding: 5px 10px;
|
42 |
-
cursor: pointer;
|
43 |
-
margin-top: 5px;
|
44 |
-
transition: background-color 0.3s, color 0.3s;
|
45 |
-
}
|
46 |
-
|
47 |
-
/* Modo claro */
|
48 |
-
@media (prefers-color-scheme: light) {
|
49 |
-
body {
|
50 |
-
background-color: #ffffff;
|
51 |
-
color: #000000;
|
52 |
-
}
|
53 |
-
h1 {
|
54 |
-
color: #007bff;
|
55 |
-
}
|
56 |
-
.response {
|
57 |
-
background-color: #f0f0f0;
|
58 |
-
color: #000000;
|
59 |
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
60 |
-
}
|
61 |
-
.footer {
|
62 |
-
color: #6c757d;
|
63 |
-
}
|
64 |
-
.audio-button {
|
65 |
-
background-color: #007bff;
|
66 |
-
color: white;
|
67 |
-
}
|
68 |
-
.audio-button:hover {
|
69 |
-
background-color: #0056b3;
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
/* Modo oscuro */
|
74 |
-
@media (prefers-color-scheme: dark) {
|
75 |
-
body {
|
76 |
-
background-color: #1a1a1a;
|
77 |
-
color: #ffffff;
|
78 |
-
}
|
79 |
-
h1 {
|
80 |
-
color: #ffcc00;
|
81 |
-
}
|
82 |
-
.response {
|
83 |
-
background-color: #333333;
|
84 |
-
color: #ffffff;
|
85 |
-
box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
|
86 |
-
}
|
87 |
-
.footer {
|
88 |
-
color: #ffcc00;
|
89 |
-
}
|
90 |
-
.audio-button {
|
91 |
-
background-color: #ffcc00;
|
92 |
-
color: #1a1a1a;
|
93 |
-
}
|
94 |
-
.audio-button:hover {
|
95 |
-
background-color: #e6b800;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
/* Estilos para elementos de Streamlit */
|
100 |
-
.stSelectbox, .stTextInput, .stButton {
|
101 |
-
margin-bottom: 10px !important;
|
102 |
-
}
|
103 |
-
|
104 |
-
/* Estilo para botones */
|
105 |
-
.stButton button {
|
106 |
-
border: none;
|
107 |
-
border-radius: 5px;
|
108 |
-
padding: 10px 20px;
|
109 |
-
cursor: pointer;
|
110 |
-
transition: background-color 0.3s;
|
111 |
-
font-size: 16px;
|
112 |
-
}
|
113 |
-
|
114 |
-
/* Modo claro para botones */
|
115 |
-
@media (prefers-color-scheme: light) {
|
116 |
-
.stButton button {
|
117 |
-
background-color: #007bff;
|
118 |
-
color: white;
|
119 |
-
}
|
120 |
-
.stButton button:hover {
|
121 |
-
background-color: #0056b3;
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
/* Modo oscuro para botones */
|
126 |
-
@media (prefers-color-scheme: dark) {
|
127 |
-
.stButton button {
|
128 |
-
background-color: #ffcc00;
|
129 |
-
color: #1a1a1a;
|
130 |
-
}
|
131 |
-
.stButton button:hover {
|
132 |
-
background-color: #e6b800;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
</style>
|
136 |
-
""", unsafe_allow_html=True)
|
137 |
-
|
138 |
# Respuestas automatizadas
|
139 |
def respuestas_automatizadas(texto):
|
140 |
texto = texto.lower()
|
@@ -221,7 +96,7 @@ with col2:
|
|
221 |
if entrada_texto:
|
222 |
with st.spinner("Generando respuesta..."):
|
223 |
resultado = procesar_texto(entrada_texto)
|
224 |
-
espacio_contenido_generado.markdown(f"<div class='response'
|
225 |
audio_data = hablar_texto(resultado)
|
226 |
if audio_data:
|
227 |
st.markdown(f"""
|
@@ -238,9 +113,9 @@ with col2:
|
|
238 |
st.image(imagen, caption='Imagen subida.', use_column_width=True)
|
239 |
with st.spinner("Procesando imagen..."):
|
240 |
respuesta = procesar_imagen(imagen)
|
241 |
-
espacio_contenido_generado.markdown(f"<div class='response'
|
242 |
|
243 |
st.write("¡Gracias por usar Soph-IA! 😊")
|
244 |
|
245 |
# Pie de página
|
246 |
-
st.markdown("<
|
|
|
10 |
|
11 |
api_key = st.secrets["API_KEY"]
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Respuestas automatizadas
|
14 |
def respuestas_automatizadas(texto):
|
15 |
texto = texto.lower()
|
|
|
96 |
if entrada_texto:
|
97 |
with st.spinner("Generando respuesta..."):
|
98 |
resultado = procesar_texto(entrada_texto)
|
99 |
+
espacio_contenido_generado.markdown(f"<div class='response'>{resultado}</div>", unsafe_allow_html=True)
|
100 |
audio_data = hablar_texto(resultado)
|
101 |
if audio_data:
|
102 |
st.markdown(f"""
|
|
|
113 |
st.image(imagen, caption='Imagen subida.', use_column_width=True)
|
114 |
with st.spinner("Procesando imagen..."):
|
115 |
respuesta = procesar_imagen(imagen)
|
116 |
+
espacio_contenido_generado.markdown(f"<div class='response'>{respuesta}</div>", unsafe_allow_html=True)
|
117 |
|
118 |
st.write("¡Gracias por usar Soph-IA! 😊")
|
119 |
|
120 |
# Pie de página
|
121 |
+
st.markdown("<p class='footer'>© 2024 Jeysshon</p>", unsafe_allow_html=True)
|