aliasgerovs commited on
Commit
a16ea6c
ยท
verified ยท
1 Parent(s): 1340fcc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
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: {model_config['labels'][prediction]}
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):