Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ def predict(image):
|
|
13 |
inputs = feature_extractor(images=image, return_tensors="pt").to(device)
|
14 |
outputs = model(**inputs)
|
15 |
logits = outputs.logits
|
16 |
-
predicted_class_prob = F.softmax(logits, dim=-1).detach().numpy().max()
|
17 |
predicted_class_idx = logits.argmax(-1).item()
|
18 |
label = model.config.id2label[predicted_class_idx].split(",")[0]
|
19 |
time.sleep(2)
|
|
|
13 |
inputs = feature_extractor(images=image, return_tensors="pt").to(device)
|
14 |
outputs = model(**inputs)
|
15 |
logits = outputs.logits
|
16 |
+
predicted_class_prob = F.softmax(logits, dim=-1).detach().cpu().numpy().max()
|
17 |
predicted_class_idx = logits.argmax(-1).item()
|
18 |
label = model.config.id2label[predicted_class_idx].split(",")[0]
|
19 |
time.sleep(2)
|