aliasgerovs
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -118,28 +118,24 @@ def process_audio(audio1, audio2):
|
|
118 |
probabilities = torch.softmax(output, dim=1)[0]
|
119 |
confidence = probabilities[prediction].item()
|
120 |
|
|
|
|
|
121 |
result = f"""
|
122 |
๐ Authentication Results:
|
123 |
|
124 |
๐น Similarity Score: {score:.4f}
|
125 |
-
๐น Classification: {
|
126 |
๐น Confidence: {confidence:.4f}
|
127 |
|
128 |
-
# Analysis Details:
|
129 |
-
# - A similarity score closer to 1.0 indicates higher voice similarity
|
130 |
-
# - Classification indicates the model's assessment of the voice comparison
|
131 |
-
# - Confidence shows how certain the model is about its classification
|
132 |
-
|
133 |
{'โ ๏ธ Potential Voice Impersonation Detected!' if prediction > 0 else 'โ
Authentic Voice Match'}
|
134 |
"""
|
135 |
-
|
136 |
return result
|
137 |
|
138 |
except Exception as e:
|
139 |
return f"An error occurred: {str(e)}"
|
140 |
|
141 |
finally:
|
142 |
-
# Clean up temporary files
|
143 |
if os.path.exists(temp_path1):
|
144 |
os.remove(temp_path1)
|
145 |
if os.path.exists(temp_path2):
|
|
|
118 |
probabilities = torch.softmax(output, dim=1)[0]
|
119 |
confidence = probabilities[prediction].item()
|
120 |
|
121 |
+
label = "Original" if prediction == 0 else "Deepfake/Impersonation"
|
122 |
+
|
123 |
result = f"""
|
124 |
๐ Authentication Results:
|
125 |
|
126 |
๐น Similarity Score: {score:.4f}
|
127 |
+
๐น Classification: {label}
|
128 |
๐น Confidence: {confidence:.4f}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
130 |
{'โ ๏ธ Potential Voice Impersonation Detected!' if prediction > 0 else 'โ
Authentic Voice Match'}
|
131 |
"""
|
132 |
+
|
133 |
return result
|
134 |
|
135 |
except Exception as e:
|
136 |
return f"An error occurred: {str(e)}"
|
137 |
|
138 |
finally:
|
|
|
139 |
if os.path.exists(temp_path1):
|
140 |
os.remove(temp_path1)
|
141 |
if os.path.exists(temp_path2):
|