Spaces:
Sleeping
Sleeping
jcmachicao
commited on
Commit
•
680f326
1
Parent(s):
c3ca6ec
Upload app.py
Browse files
app.py
CHANGED
@@ -44,45 +44,49 @@ st.title('Generación de Base Tensores')
|
|
44 |
st.subheader('**Procedimiento: Generación de Identidad Digital Base**')
|
45 |
|
46 |
nom_oper = st.text_input('Nombre del Comparador(a) que realizará evaluación')
|
47 |
-
nom_oper = nom_oper.replace(' ', '')
|
48 |
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
l_pics = 1
|
53 |
-
for i, col in enumerate(st.columns(1)):
|
54 |
-
col.image('images/void.jpg', width=150)
|
55 |
-
else:
|
56 |
-
|
57 |
-
codtotx = genera_imagenes_base(up_files)
|
58 |
-
|
59 |
-
n_fil = 5
|
60 |
-
l_pics = int(len(codtotx.lista))
|
61 |
-
filas = int(np.round(l_pics/n_fil,0)) + 1
|
62 |
-
st.write(l_pics)
|
63 |
-
st.write('Procesando imagenes...')
|
64 |
-
imagenes = list(codtotx.imagenes)
|
65 |
-
|
66 |
-
for fila in range(filas):
|
67 |
-
st.write(fila)
|
68 |
-
for i, col in enumerate(st.columns(n_fil)):
|
69 |
-
try:
|
70 |
-
col.image(up_files[i+fila*n_fil], width=150)
|
71 |
-
except:
|
72 |
-
pass
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
c1, c2, c3 = st.columns(3)
|
88 |
with c1:
|
|
|
44 |
st.subheader('**Procedimiento: Generación de Identidad Digital Base**')
|
45 |
|
46 |
nom_oper = st.text_input('Nombre del Comparador(a) que realizará evaluación')
|
|
|
47 |
|
48 |
+
if nom_oper in ['David Burga 7453', 'Jose Machicao 5434']:
|
49 |
|
50 |
+
up_files = st.file_uploader('Elija archivos base hasta 50 items: ', accept_multiple_files=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
if not up_files:
|
53 |
+
l_pics = 1
|
54 |
+
for i, col in enumerate(st.columns(1)):
|
55 |
+
col.image('images/void.jpg', width=150)
|
56 |
+
else:
|
57 |
|
58 |
+
codtotx = genera_imagenes_base(up_files)
|
59 |
+
|
60 |
+
n_fil = 5
|
61 |
+
l_pics = int(len(codtotx.lista))
|
62 |
+
filas = int(np.round(l_pics/n_fil,0)) + 1
|
63 |
+
st.write(l_pics)
|
64 |
+
st.write('Procesando imagenes...')
|
65 |
+
imagenes = list(codtotx.imagenes)
|
66 |
+
|
67 |
+
for fila in range(filas):
|
68 |
+
st.write(fila)
|
69 |
+
for i, col in enumerate(st.columns(n_fil)):
|
70 |
+
try:
|
71 |
+
col.image(up_files[i+fila*n_fil], width=150)
|
72 |
+
except:
|
73 |
+
pass
|
74 |
+
|
75 |
+
st.write('Reportando: Archivo Base Generado')
|
76 |
+
|
77 |
+
timestamp = datetime.datetime.now()
|
78 |
+
ts = timestamp.strftime('%Y_%m_%d_%H_%M')
|
79 |
+
#nom_archivo = 'tensores_base_' + ts + '_' + nom_oper + '.pkl'
|
80 |
+
st.write('Archivo generado por: ', nom_oper)
|
81 |
+
st.write('Tiempo de generación: ', ts)
|
82 |
+
|
83 |
+
output_pkl = pickle.dumps(codtotx)
|
84 |
+
b64 = base64.b64encode(output_pkl).decode()
|
85 |
+
href = f'<a href="data:file/output_model;base64,{b64}" download="tensores.pkl">Descargar Tensores PKL</a>'
|
86 |
+
st.markdown(href, unsafe_allow_html=True)
|
87 |
+
|
88 |
+
else:
|
89 |
+
st.write('Por favor escriba una autorización válida.')
|
90 |
|
91 |
c1, c2, c3 = st.columns(3)
|
92 |
with c1:
|