Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files
pages/Entorno de Ejecución.py
CHANGED
@@ -169,25 +169,34 @@ with zero_shot:
|
|
169 |
with col_a:
|
170 |
|
171 |
st.title("Clasificación Zero-Shot")
|
172 |
-
st.caption("Usando
|
173 |
-
|
174 |
-
clip = "openai/clip-vit-large-patch14-336"
|
175 |
|
176 |
labels_for_classification = ["A yellow deep fried smashed plantain",
|
177 |
"Fried food",
|
178 |
"Anything"]
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
uploaded_file = st.file_uploader(key = 'ZS_upload', label = 'Sube la imagen a clasificar',type= ['jpg','png', 'jpeg', 'jfif', 'webp', 'heic'])
|
181 |
threshold = st.slider('¿Cuál va a ser el límite desde donde se considere patacón? (se recomienda por encima del 33.33%)', 0, 100, 34, key = 'threshold_ZS')
|
182 |
-
|
183 |
with col_b:
|
184 |
|
185 |
|
186 |
if st.button(key = 'ZS_button', label ='¿Hay un patacón en la imagen?'):
|
187 |
-
if
|
|
|
|
|
188 |
if not zsloaded:
|
189 |
with st.spinner("Cargando modelo de clasificación..."):
|
190 |
-
classifier = pipeline("zero-shot-image-classification", model =
|
191 |
zsloaded = True
|
192 |
with st.spinner('Cargando predicción...'):
|
193 |
img = preprocess(uploaded_file, module = 'pil')
|
|
|
169 |
with col_a:
|
170 |
|
171 |
st.title("Clasificación Zero-Shot")
|
172 |
+
st.caption("Usando Clip de OpenAI y Convnext de Facebook")
|
|
|
|
|
173 |
|
174 |
labels_for_classification = ["A yellow deep fried smashed plantain",
|
175 |
"Fried food",
|
176 |
"Anything"]
|
177 |
+
|
178 |
+
|
179 |
+
model_dict = {
|
180 |
+
'Clip (openai/clip-vit-large-patch14-336)' : 'frncscp/patacoptimus-prime',
|
181 |
+
'Convnext (facebook/convnext-large-224)' : 'frncscp/pataconxt'
|
182 |
+
}
|
183 |
+
|
184 |
+
model_choice = st.multiselect("Seleccione uno o varios modelos de clasificación", model_dict.keys(), key = 'zs_multiselect')
|
185 |
+
|
186 |
+
|
187 |
uploaded_file = st.file_uploader(key = 'ZS_upload', label = 'Sube la imagen a clasificar',type= ['jpg','png', 'jpeg', 'jfif', 'webp', 'heic'])
|
188 |
threshold = st.slider('¿Cuál va a ser el límite desde donde se considere patacón? (se recomienda por encima del 33.33%)', 0, 100, 34, key = 'threshold_ZS')
|
189 |
+
|
190 |
with col_b:
|
191 |
|
192 |
|
193 |
if st.button(key = 'ZS_button', label ='¿Hay un patacón en la imagen?'):
|
194 |
+
if len(model_choice) != 1:
|
195 |
+
print('Recuerda seleccionar un solo modelo de clasificación')
|
196 |
+
elif uploaded_file is not None:
|
197 |
if not zsloaded:
|
198 |
with st.spinner("Cargando modelo de clasificación..."):
|
199 |
+
classifier = pipeline("zero-shot-image-classification", model = model_choice[0])
|
200 |
zsloaded = True
|
201 |
with st.spinner('Cargando predicción...'):
|
202 |
img = preprocess(uploaded_file, module = 'pil')
|