Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -205,19 +205,20 @@ if picture is not None:
|
|
205 |
webcam_ds = dataset_prod_obj.create_dataset(picture, webcam=True)
|
206 |
webcam_dl = DataLoader(webcam_ds, batch_size=BATCH_SIZE)
|
207 |
|
208 |
-
|
209 |
-
prod_inputs = next(iter(webcam_dl))
|
210 |
-
st.write(prod_inputs['pixel_values'].shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
st.write(image_paths)
|
218 |
-
|
219 |
-
# Display the results
|
220 |
-
if predictions[match_idx] <= 0.3:
|
221 |
-
st.write('Welcome: ',image_paths[match_idx].split('/')[-1].split('.')[0])
|
222 |
-
else:
|
223 |
-
st.write("Match not found")
|
|
|
205 |
webcam_ds = dataset_prod_obj.create_dataset(picture, webcam=True)
|
206 |
webcam_dl = DataLoader(webcam_ds, batch_size=BATCH_SIZE)
|
207 |
|
208 |
+
## Testing the dataloader
|
209 |
+
#prod_inputs = next(iter(webcam_dl))
|
210 |
+
#st.write(prod_inputs['pixel_values'].shape)
|
211 |
+
|
212 |
+
with st.spinner("Wait for it...", show_time=True):
|
213 |
+
# Run the predictions
|
214 |
+
prediction = prod_function(model_pretrained, prod_dl, webcam_dl)
|
215 |
+
predictions = torch.cat(prediction, 0).to(device)
|
216 |
+
match_idx = torch.argmin(predictions)
|
217 |
+
st.write(predictions)
|
218 |
+
st.write(image_paths)
|
219 |
|
220 |
+
# Display the results
|
221 |
+
if predictions[match_idx] <= 0.5:
|
222 |
+
st.write('Welcome: ',image_paths[match_idx].split('/')[-1].split('.')[0])
|
223 |
+
else:
|
224 |
+
st.write("Match not found")
|
|
|
|
|
|
|
|
|
|
|
|
|
|