Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files
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#, AutoProcessor, AutoModelForZeroShotImageClassification
|
5 |
from PIL import Image
|
6 |
import os
|
7 |
import torch
|
@@ -170,7 +170,7 @@ with vit:
|
|
170 |
'microsoft/swin-tiny-patch4-window7-224' : 'frncscp/patacoswin'
|
171 |
}
|
172 |
|
173 |
-
model_choice = st.
|
174 |
|
175 |
uploaded_file = st.file_uploader(key = 'ViT_upload', label = 'Sube la imagen a clasificar',type= ['jpg','png', 'jpeg', 'jfif', 'webp', 'heic'])
|
176 |
flag = False
|
@@ -186,7 +186,10 @@ with vit:
|
|
186 |
|
187 |
#y_gorritoo = query(uploaded_file.read(), model_dict[model_choice[0]])
|
188 |
#st.write(y_gorritoo)
|
189 |
-
|
|
|
|
|
|
|
190 |
|
191 |
#classifier = pipeline("image-classification", model= model_dict[model_choice[0]])
|
192 |
img = preprocess(uploaded_file, module = 'pil')
|
|
|
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, Dinov2Model#, AutoProcessor, AutoModelForZeroShotImageClassification
|
5 |
from PIL import Image
|
6 |
import os
|
7 |
import torch
|
|
|
170 |
'microsoft/swin-tiny-patch4-window7-224' : 'frncscp/patacoswin'
|
171 |
}
|
172 |
|
173 |
+
model_choice = st.selectbox("Seleccione un modelo de clasificación", model_dict.keys(), key = 'ViT_select')
|
174 |
|
175 |
uploaded_file = st.file_uploader(key = 'ViT_upload', label = 'Sube la imagen a clasificar',type= ['jpg','png', 'jpeg', 'jfif', 'webp', 'heic'])
|
176 |
flag = False
|
|
|
186 |
|
187 |
#y_gorritoo = query(uploaded_file.read(), model_dict[model_choice[0]])
|
188 |
#st.write(y_gorritoo)
|
189 |
+
if "frncscp/dinotron" in model_choice.values():
|
190 |
+
classifiers = [Dinov2Model.from_pretrained("frncscp/dinotron")]
|
191 |
+
else:
|
192 |
+
classifiers = [pipeline("image-classification", model= model_dict[model_choice[i]]) for i in range(len(model_choice))]
|
193 |
|
194 |
#classifier = pipeline("image-classification", model= model_dict[model_choice[0]])
|
195 |
img = preprocess(uploaded_file, module = 'pil')
|