Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ import re
|
|
| 13 |
import matplotlib.pyplot as plt
|
| 14 |
import base64
|
| 15 |
import pdfkit
|
| 16 |
-
|
| 17 |
##-hola-
|
| 18 |
|
| 19 |
st.set_page_config(page_title="Revisor de Modelos IFC", page_icon="馃搱")
|
|
@@ -31,6 +31,13 @@ hide_st_style = """
|
|
| 31 |
st.markdown(hide_st_style, unsafe_allow_html=True)
|
| 32 |
base="light"
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
def cargar_datos_desde_json(tipo_modelo, nivel_avance):
|
| 35 |
# Genera la ruta completa del archivo JSON basado en la selecci贸n del usuario
|
| 36 |
nombre_archivo = f"{tipo_modelo}_{nivel_avance}.json"
|
|
@@ -479,7 +486,14 @@ def main():
|
|
| 479 |
st.subheader("Respuestas del cuestionario:")
|
| 480 |
for pregunta, respuesta in respuestas.items():
|
| 481 |
st.write(f"- {pregunta}: {respuesta}")
|
| 482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
# Generar el enlace para descargar el archivo Excel
|
| 484 |
with open('resultados_validacion.xlsx', 'rb') as f:
|
| 485 |
excel_data = f.read()
|
|
@@ -487,5 +501,8 @@ def main():
|
|
| 487 |
href = f'<a href="data:file/excel;base64,{b64}" download="resultados_validacion.xlsx">Descargar Resultados de Validaci贸n (Excel)</a>'
|
| 488 |
st.markdown(href, unsafe_allow_html=True)
|
| 489 |
|
|
|
|
|
|
|
|
|
|
| 490 |
if __name__ == "__main__":
|
| 491 |
main()
|
|
|
|
| 13 |
import matplotlib.pyplot as plt
|
| 14 |
import base64
|
| 15 |
import pdfkit
|
| 16 |
+
import mysql.connector
|
| 17 |
##-hola-
|
| 18 |
|
| 19 |
st.set_page_config(page_title="Revisor de Modelos IFC", page_icon="馃搱")
|
|
|
|
| 31 |
st.markdown(hide_st_style, unsafe_allow_html=True)
|
| 32 |
base="light"
|
| 33 |
|
| 34 |
+
connection = mysql.connector.connect(
|
| 35 |
+
host="srv848.hstgr.io",
|
| 36 |
+
user="u539776097_oWm4C",
|
| 37 |
+
password="Nekoryu1234.",
|
| 38 |
+
database="u539776097_f0Qes"
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
def cargar_datos_desde_json(tipo_modelo, nivel_avance):
|
| 42 |
# Genera la ruta completa del archivo JSON basado en la selecci贸n del usuario
|
| 43 |
nombre_archivo = f"{tipo_modelo}_{nivel_avance}.json"
|
|
|
|
| 486 |
st.subheader("Respuestas del cuestionario:")
|
| 487 |
for pregunta, respuesta in respuestas.items():
|
| 488 |
st.write(f"- {pregunta}: {respuesta}")
|
| 489 |
+
|
| 490 |
+
# Generar insercion de base datos
|
| 491 |
+
cursor2 = connection.cursor()
|
| 492 |
+
|
| 493 |
+
insert_KPI = "INSERT INTO `TablaKPI`(`DIRECCION`, `TiempoPromedioProceso`, `PorcentajePrecision`, `TiempoPromedioEjecucion`, `PorcentajeConcordancia`, `CumpleRequisitosSDO`, `TiempoPromedioRespuesta`, `ProblemaInteroperabilidad`, `NivelSatifaccion`) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)"
|
| 494 |
+
cursor2.execute(insert_KPI,("DA", tiempo_procesamiento , precision_deteccion , tiempo_ejecucion , concordancia_revisiones , cumplimiento_requisitos , tiempo_respuesta , problemas_interoperabilidad , satisfaccion_usuario))
|
| 495 |
+
connection.commit()
|
| 496 |
+
|
| 497 |
# Generar el enlace para descargar el archivo Excel
|
| 498 |
with open('resultados_validacion.xlsx', 'rb') as f:
|
| 499 |
excel_data = f.read()
|
|
|
|
| 501 |
href = f'<a href="data:file/excel;base64,{b64}" download="resultados_validacion.xlsx">Descargar Resultados de Validaci贸n (Excel)</a>'
|
| 502 |
st.markdown(href, unsafe_allow_html=True)
|
| 503 |
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
|
| 507 |
if __name__ == "__main__":
|
| 508 |
main()
|