Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -137,15 +137,15 @@ def main():
|
|
137 |
# Procesamiento automático al cargar documentos
|
138 |
if pdf_docs and not st.session_state.documento_cargado:
|
139 |
with st.spinner("Procesando documento..."):
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
|
150 |
# Interfaz de consultas
|
151 |
if st.session_state.documento_cargado:
|
@@ -166,4 +166,4 @@ def main():
|
|
166 |
st.info("Por favor sube un archivo PDF para comenzar.")
|
167 |
|
168 |
if __name__ == "__main__":
|
169 |
-
main()
|
|
|
137 |
# Procesamiento automático al cargar documentos
|
138 |
if pdf_docs and not st.session_state.documento_cargado:
|
139 |
with st.spinner("Procesando documento..."):
|
140 |
+
try:
|
141 |
+
raw_text = get_pdf_text(pdf_docs)
|
142 |
+
text_chunks = get_text_chunks(raw_text)
|
143 |
+
vector_store = get_vector_store(text_chunks)
|
144 |
+
st.session_state.vector_store = vector_store
|
145 |
+
st.session_state.documento_cargado = True
|
146 |
+
st.success("Documento procesado exitosamente.")
|
147 |
+
except Exception as e:
|
148 |
+
st.error(f"Error procesando documento: {str(e)}")
|
149 |
|
150 |
# Interfaz de consultas
|
151 |
if st.session_state.documento_cargado:
|
|
|
166 |
st.info("Por favor sube un archivo PDF para comenzar.")
|
167 |
|
168 |
if __name__ == "__main__":
|
169 |
+
main()
|