File size: 1,781 Bytes
df3e474
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cd7c81a
 
df3e474
 
 
 
 
 
 
 
 
cd7c81a
 
 
 
df3e474
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 27 16:16:06 2022

@author: Usuario
"""
import streamlit as st
import imagen_subida as ims
from keras.models import load_model
from os import system
#Cargar el modelo
import os
import patoolib
from shutil import rmtree
from os import remove

"""
Comentado por falta de 7z, se sube el archivo descomprimido directamente
if os.path.isdir("./model_subir/model") == True:
    rmtree("./model_subir/model/")
if os.path.isfile("./model_subir/test_model.zip") == True:
    remove("./model_subir/test_model.zip")
os.system("cat ./model_subir/vgg19_trainable_true_best_model_pruebita.7z.* > ./model_subir/test_model.zip")

 
patoolib.extract_archive("./model_subir/test_model.zip",outdir="./model_subir/model/")
#model = load_model('../../../model/classification/vgg19_trainable_true_best_model.h5')

"""


model = load_model('./model_subir/model/vgg19_trainable_true_best_model.h5')

size = (224, 224)

def main_page(clicked, label_names):
    title = ims.change_title(clicked)
    labs = ims.change_labels(clicked)
    column1, column2 = st.columns(2)
    holder_up = st.empty()

    with column1:
        st.write('')
        uploaded_image = holder_up.file_uploader('')

    holder_add_text = st.empty()
    with column2:
        additional_text = '' #holder_add_text.write('In order to estimate which is the classification of your image, drop your file at the left')
        
    if uploaded_image:
        #container = st.container()
        add_tex = ims.additional_text_chart(clicked) #
        st.write(add_tex)
        result_texts = ims.result_text(clicked)
        ims.resultados(uploaded_image, model, size, label_names, labs, result_texts)
        #container.markdown(res)
        holder_up.empty()
        holder_add_text.empty()