Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -200,14 +200,18 @@ if picture is not None:
|
|
200 |
## Create DataLoader for Webcam Image
|
201 |
webcam_ds = dataset_prod_obj.create_dataset(picture, webcam=True)
|
202 |
webcam_dl = DataLoader(webcam_ds, batch_size=BATCH_SIZE)
|
|
|
|
|
|
|
|
|
203 |
|
204 |
## Run the predictions
|
205 |
-
prediction = prod_function(model_pretrained, prod_dl, webcam_dl)
|
206 |
-
predictions = torch.cat(prediction, 0).to(device)
|
207 |
-
match_idx = torch.argmin(predictions)
|
208 |
|
209 |
## Display the results
|
210 |
-
if predictions[match_idx] <= 0.3:
|
211 |
-
|
212 |
-
else:
|
213 |
-
|
|
|
200 |
## Create DataLoader for Webcam Image
|
201 |
webcam_ds = dataset_prod_obj.create_dataset(picture, webcam=True)
|
202 |
webcam_dl = DataLoader(webcam_ds, batch_size=BATCH_SIZE)
|
203 |
+
|
204 |
+
# Testing the dataloader
|
205 |
+
prod_inputs = next(iter(webcam_dl))
|
206 |
+
st.write(prod_inputs['pixel_values'].shape)
|
207 |
|
208 |
## Run the predictions
|
209 |
+
#prediction = prod_function(model_pretrained, prod_dl, webcam_dl)
|
210 |
+
#predictions = torch.cat(prediction, 0).to(device)
|
211 |
+
#match_idx = torch.argmin(predictions)
|
212 |
|
213 |
## Display the results
|
214 |
+
#if predictions[match_idx] <= 0.3:
|
215 |
+
# st.write('Welcome: ',image_paths[match_idx].split('/')[-1].split('.')[0])
|
216 |
+
#else:
|
217 |
+
# st.write("Match not found")
|