Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files
pages/Entorno de Ejecución.py
CHANGED
@@ -52,7 +52,6 @@ def query(data, model_name): #HF API
|
|
52 |
response = requests.post(API_URL + "/" + model_name, headers=headers, data=data)
|
53 |
while "error" in response.json():
|
54 |
response = requests.post(API_URL + "/" + model_name, headers=headers, data=data)
|
55 |
-
st.write("Done.")
|
56 |
return response.json() #.json
|
57 |
|
58 |
@st.cache_resource
|
@@ -194,7 +193,7 @@ with vit:
|
|
194 |
# return y_gorrito / len(classifier_list)
|
195 |
|
196 |
|
197 |
-
y_gorrito = query(uploaded_file.read(), model_choice[0])[1]["score"]
|
198 |
|
199 |
#for model in model_choice:
|
200 |
# api_result = query(uploaded_file.read(), model_dict[model])
|
@@ -210,14 +209,14 @@ with vit:
|
|
210 |
|
211 |
#y_gorrito = classifier[0]["score"]
|
212 |
|
213 |
-
|
214 |
#y_gorrito = vit_ensemble(classifiers, img)
|
215 |
-
|
216 |
-
if round(float(y_gorrito * 100)) >= threshold:
|
217 |
-
|
218 |
-
else:
|
219 |
-
|
220 |
-
st.caption(f'La probabilidad de que la imagen tenga un patacón es del: {round(float(y_gorrito * 100), 2)}%')
|
221 |
st.image(img)
|
222 |
else:
|
223 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|
|
|
52 |
response = requests.post(API_URL + "/" + model_name, headers=headers, data=data)
|
53 |
while "error" in response.json():
|
54 |
response = requests.post(API_URL + "/" + model_name, headers=headers, data=data)
|
|
|
55 |
return response.json() #.json
|
56 |
|
57 |
@st.cache_resource
|
|
|
193 |
# return y_gorrito / len(classifier_list)
|
194 |
|
195 |
|
196 |
+
#y_gorrito = query(uploaded_file.read(), model_choice[0])[1]["score"]
|
197 |
|
198 |
#for model in model_choice:
|
199 |
# api_result = query(uploaded_file.read(), model_dict[model])
|
|
|
209 |
|
210 |
#y_gorrito = classifier[0]["score"]
|
211 |
|
212 |
+
st.write(api_result)
|
213 |
#y_gorrito = vit_ensemble(classifiers, img)
|
214 |
+
#
|
215 |
+
#if round(float(y_gorrito * 100)) >= threshold:
|
216 |
+
# st.success("¡Patacón Detectado!")
|
217 |
+
#else:
|
218 |
+
# st.error("No se considera que haya un patacón en la imagen")
|
219 |
+
#st.caption(f'La probabilidad de que la imagen tenga un patacón es del: {round(float(y_gorrito * 100), 2)}%')
|
220 |
st.image(img)
|
221 |
else:
|
222 |
st.write("Asegúrate de haber subido correctamente la imagen.")
|