Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,20 +13,17 @@ import re
|
|
13 |
load_dotenv()
|
14 |
os.getenv("GROQ_API_KEY")
|
15 |
|
16 |
-
|
17 |
<style>
|
18 |
-
.main-title {
|
19 |
-
font-size: 28px; /* Reducir tamaño del texto */
|
20 |
-
margin-top: -20px; /* Reducir espacio superior */
|
21 |
-
margin-bottom: 10px; /* Reducir espacio inferior */
|
22 |
-
text-align: center;
|
23 |
-
color: #252850;
|
24 |
-
}
|
25 |
.step-number { font-size: 24px; font-weight: bold; }
|
26 |
-
.response-box { padding: 20px; background-color: #f8f9fa; border-radius: 10px; border-left: 5px solid #252850; margin: 20px 0; }
|
27 |
.metadata-box { padding: 20px; background-color: #f0f2f6; border-radius: 10px; margin-bottom: 20px; }
|
|
|
|
|
|
|
|
|
28 |
</style>
|
29 |
-
"""
|
30 |
|
31 |
def eliminar_proceso_pensamiento(texto):
|
32 |
texto_limpio = re.sub(r'<.*?>', '', texto, flags=re.DOTALL)
|
@@ -54,13 +51,10 @@ def get_conversational_chain():
|
|
54 |
Responde en español exclusivamente con la información solicitada usando el contexto, además sé lo más extenso y detallado posible
|
55 |
siempre que se pueda desarollar, como explicando el contenido de referencias nombradas.
|
56 |
Formato: Respuesta directa sin prefijos. Si no hay información, di "No disponible".
|
57 |
-
|
58 |
Contexto:
|
59 |
{context}
|
60 |
-
|
61 |
Pregunta:
|
62 |
{question}
|
63 |
-
|
64 |
Respuesta:
|
65 |
"""
|
66 |
model = ChatGroq(
|
@@ -106,7 +100,6 @@ def generar_sugerencias():
|
|
106 |
1. [Pregunta completa en español]
|
107 |
2. [Pregunta completa en español]
|
108 |
3. [Pregunta completa en español]
|
109 |
-
|
110 |
Contexto:
|
111 |
{context}
|
112 |
"""
|
@@ -149,7 +142,8 @@ def procesar_consulta(user_question):
|
|
149 |
|
150 |
def main():
|
151 |
st.set_page_config(page_title="PDF Consultor 🔍", page_icon="🔍", layout="wide")
|
152 |
-
st.
|
|
|
153 |
|
154 |
estados = {
|
155 |
'documento_cargado': False,
|
@@ -205,7 +199,7 @@ def main():
|
|
205 |
with st.container():
|
206 |
st.markdown("""
|
207 |
<div class="suggestion-container">
|
208 |
-
<div style="font-size:
|
209 |
""", unsafe_allow_html=True)
|
210 |
|
211 |
cols_sugerencias = st.columns(3)
|
@@ -235,4 +229,4 @@ def main():
|
|
235 |
st.info("Por favor, sube un documento PDF para comenzar.")
|
236 |
|
237 |
if __name__ == "__main__":
|
238 |
-
main()
|
|
|
13 |
load_dotenv()
|
14 |
os.getenv("GROQ_API_KEY")
|
15 |
|
16 |
+
css_style = """
|
17 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
.step-number { font-size: 24px; font-weight: bold; }
|
19 |
+
.response-box { padding: 20px; background-color: #f8f9fa; border-radius: 10px; border-left: 5px solid #252850; margin: 20px 0; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
20 |
.metadata-box { padding: 20px; background-color: #f0f2f6; border-radius: 10px; margin-bottom: 20px; }
|
21 |
+
.custom-input { font-size: 16px; padding: 10px; border-radius: 5px; border: 1px solid #ccc; }
|
22 |
+
.suggestion-container { border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; margin: 10px 0; background: #f8f9fa; }
|
23 |
+
.suggestion-btn { width: 100%; margin: 3px 0; padding: 8px; border-radius: 5px; border: 1px solid #252850; background: white; cursor: pointer; transition: all 0.2s; }
|
24 |
+
.suggestion-btn:hover { background: #252850; color: white; }
|
25 |
</style>
|
26 |
+
"""
|
27 |
|
28 |
def eliminar_proceso_pensamiento(texto):
|
29 |
texto_limpio = re.sub(r'<.*?>', '', texto, flags=re.DOTALL)
|
|
|
51 |
Responde en español exclusivamente con la información solicitada usando el contexto, además sé lo más extenso y detallado posible
|
52 |
siempre que se pueda desarollar, como explicando el contenido de referencias nombradas.
|
53 |
Formato: Respuesta directa sin prefijos. Si no hay información, di "No disponible".
|
|
|
54 |
Contexto:
|
55 |
{context}
|
|
|
56 |
Pregunta:
|
57 |
{question}
|
|
|
58 |
Respuesta:
|
59 |
"""
|
60 |
model = ChatGroq(
|
|
|
100 |
1. [Pregunta completa en español]
|
101 |
2. [Pregunta completa en español]
|
102 |
3. [Pregunta completa en español]
|
|
|
103 |
Contexto:
|
104 |
{context}
|
105 |
"""
|
|
|
142 |
|
143 |
def main():
|
144 |
st.set_page_config(page_title="PDF Consultor 🔍", page_icon="🔍", layout="wide")
|
145 |
+
st.title("PDF Consultor 🔍")
|
146 |
+
st.markdown(css_style, unsafe_allow_html=True)
|
147 |
|
148 |
estados = {
|
149 |
'documento_cargado': False,
|
|
|
199 |
with st.container():
|
200 |
st.markdown("""
|
201 |
<div class="suggestion-container">
|
202 |
+
<div style="font-size:14px; color:#666; margin-bottom:8px;">💡 ¿Necesitas ideas?</div>
|
203 |
""", unsafe_allow_html=True)
|
204 |
|
205 |
cols_sugerencias = st.columns(3)
|
|
|
229 |
st.info("Por favor, sube un documento PDF para comenzar.")
|
230 |
|
231 |
if __name__ == "__main__":
|
232 |
+
main()
|