Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -115,7 +115,7 @@ def real_fake_check(list_dir, path, model):
|
|
| 115 |
THRESHOLD = 0.4 #딥페이크 기준을 0.4로 설정
|
| 116 |
r_cnt = 0
|
| 117 |
f_cnt = 0
|
| 118 |
-
prob = []
|
| 119 |
for i in list_dir: # real / fake 선택
|
| 120 |
input_data = extract_mfcc_path(os.path.join(path, i))
|
| 121 |
#input_data = torch.tensor(input_data).unsqueeze(0).to('cuda') # 배치 차원을 추가하여 (1, input_dim, sequence_length)로 맞춤
|
|
@@ -124,7 +124,7 @@ def real_fake_check(list_dir, path, model):
|
|
| 124 |
probabilities = F.softmax(result, dim=1)
|
| 125 |
#prob[i]='%.2f'%probabilities[0][1].item()
|
| 126 |
#prob[i]=round(probabilities[0][1].item(),2)
|
| 127 |
-
|
| 128 |
predicted_class = 0 if probabilities[0][0] >= THRESHOLD else 1 # 확률값이 기준치보다 크다면 real, 아니면 fake
|
| 129 |
if predicted_class == 0:
|
| 130 |
r_cnt += 1
|
|
|
|
| 115 |
THRESHOLD = 0.4 #딥페이크 기준을 0.4로 설정
|
| 116 |
r_cnt = 0
|
| 117 |
f_cnt = 0
|
| 118 |
+
prob = [ ]
|
| 119 |
for i in list_dir: # real / fake 선택
|
| 120 |
input_data = extract_mfcc_path(os.path.join(path, i))
|
| 121 |
#input_data = torch.tensor(input_data).unsqueeze(0).to('cuda') # 배치 차원을 추가하여 (1, input_dim, sequence_length)로 맞춤
|
|
|
|
| 124 |
probabilities = F.softmax(result, dim=1)
|
| 125 |
#prob[i]='%.2f'%probabilities[0][1].item()
|
| 126 |
#prob[i]=round(probabilities[0][1].item(),2)
|
| 127 |
+
prob.append(round(probabilities[0][1].item(),2))
|
| 128 |
predicted_class = 0 if probabilities[0][0] >= THRESHOLD else 1 # 확률값이 기준치보다 크다면 real, 아니면 fake
|
| 129 |
if predicted_class == 0:
|
| 130 |
r_cnt += 1
|