Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -35,6 +35,11 @@ def predict_voice(audio_file_path):
|
|
35 |
label = model.config.id2label[predicted_index.item()]
|
36 |
confidence = torch.softmax(logits, dim=1).max().item() * 100
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
result = f"The voice is classified as '{label}' with a confidence of {confidence:.2f}%."
|
39 |
logging.info("Prediction successful.")
|
40 |
except Exception as e:
|
|
|
35 |
label = model.config.id2label[predicted_index.item()]
|
36 |
confidence = torch.softmax(logits, dim=1).max().item() * 100
|
37 |
|
38 |
+
# Debugging logs
|
39 |
+
logging.info(f"Logits: {logits}")
|
40 |
+
logging.info(f"Predicted index: {predicted_index}")
|
41 |
+
logging.info(f"Label: {label}, Confidence: {confidence}")
|
42 |
+
|
43 |
result = f"The voice is classified as '{label}' with a confidence of {confidence:.2f}%."
|
44 |
logging.info("Prediction successful.")
|
45 |
except Exception as e:
|