Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files
pages/Entorno de Ejecución.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.models import load_model
|
|
|
|
|
4 |
import os
|
5 |
import cv2
|
6 |
import numpy as np
|
@@ -126,4 +128,24 @@ with iforest:
|
|
126 |
with gan:
|
127 |
st.write('Próximamente')
|
128 |
with vit:
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import tensorflow as tf
|
3 |
from tensorflow.keras.models import load_model
|
4 |
+
from transformers import pipeline
|
5 |
+
|
6 |
import os
|
7 |
import cv2
|
8 |
import numpy as np
|
|
|
128 |
with gan:
|
129 |
st.write('Próximamente')
|
130 |
with vit:
|
131 |
+
|
132 |
+
col_a, col_b = st.columns(2)
|
133 |
+
|
134 |
+
with col_a:
|
135 |
+
st.title('Visual Transformer')
|
136 |
+
st.caption('One class is all you need!')
|
137 |
+
uploaded_file = st.file_uploader(label = 'Sube la imagen a clasificar',type= ['jpg','png', 'jpeg', 'jfif', 'webp', 'heic'])
|
138 |
+
if st.button('¿Hay un patacón en la imagen?'):
|
139 |
+
if uploaded_file is not None:
|
140 |
+
classifier = pipeline("image-classification", model="frncscp/patacoptimus-prime")
|
141 |
+
img = preprocess(uploaded_file)
|
142 |
+
raw_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
143 |
+
img = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT))
|
144 |
+
classifier(img)
|
145 |
+
else:
|
146 |
+
st.write("Asegúrate de haber subido correctamente la imagen.")
|
147 |
+
|
148 |
+
|
149 |
+
|
150 |
+
|
151 |
+
|