Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files- pages/Entorno de Ejecución.py +12 -11
pages/Entorno de Ejecución.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.models import load_model
|
4 |
-
from transformers import AutoConfig, AutoModel, pipeline
|
5 |
from PIL import Image
|
6 |
import os
|
7 |
import cv2
|
@@ -112,7 +112,7 @@ with cnn:
|
|
112 |
|
113 |
with col_b:
|
114 |
|
115 |
-
uploaded_file = st.file_uploader(key = '
|
116 |
|
117 |
if st.button(key = 'convnet_button', label ='¿Hay un patacón en la imagen?'):
|
118 |
if len(model_choice) < 1:
|
@@ -184,14 +184,14 @@ with vit:
|
|
184 |
#img = preprocess(uploaded_file, module = 'pil')
|
185 |
|
186 |
|
187 |
-
def vit_ensemble(classifier_list, img):
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
|
196 |
|
197 |
y_gorrito = 0
|
@@ -200,7 +200,8 @@ with vit:
|
|
200 |
api_result = query(uploaded_file.read(), model_dict[model])
|
201 |
y_gorrito += api_result[1]["score"]
|
202 |
y_gorrito /= len(model_choice)
|
203 |
-
|
|
|
204 |
#classifier = classifier(img)
|
205 |
|
206 |
#for clase in classifier:
|
|
|
1 |
import streamlit as st
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.models import load_model
|
4 |
+
from transformers import AutoConfig, AutoModel, pipeline#, AutoProcessor, AutoModelForZeroShotImageClassification
|
5 |
from PIL import Image
|
6 |
import os
|
7 |
import cv2
|
|
|
112 |
|
113 |
with col_b:
|
114 |
|
115 |
+
uploaded_file = st.file_uploader(key = 'conv_upload', label = 'Sube la imagen a clasificar',type= ['jpg','png', 'jpeg', 'jfif', 'webp', 'heic'])
|
116 |
|
117 |
if st.button(key = 'convnet_button', label ='¿Hay un patacón en la imagen?'):
|
118 |
if len(model_choice) < 1:
|
|
|
184 |
#img = preprocess(uploaded_file, module = 'pil')
|
185 |
|
186 |
|
187 |
+
#def vit_ensemble(classifier_list, img):
|
188 |
+
# y_gorrito = 0
|
189 |
+
# for classifier in classifier_list:
|
190 |
+
# classifier = classifier(img)
|
191 |
+
# for clase in classifier:
|
192 |
+
# if clase['label'] == 'Patacon-True':
|
193 |
+
# y_gorrito += clase["score"]
|
194 |
+
# return y_gorrito / len(classifier_list)
|
195 |
|
196 |
|
197 |
y_gorrito = 0
|
|
|
200 |
api_result = query(uploaded_file.read(), model_dict[model])
|
201 |
y_gorrito += api_result[1]["score"]
|
202 |
y_gorrito /= len(model_choice)
|
203 |
+
|
204 |
+
st.write("y gorrito calculado")
|
205 |
#classifier = classifier(img)
|
206 |
|
207 |
#for clase in classifier:
|