Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load
|
5 |
model = pipeline("audio-classification", model="motheecreator/Deepfake-audio-detection")
|
6 |
|
7 |
-
def
|
8 |
-
result = model(audio)
|
9 |
-
|
10 |
-
|
11 |
-
score
|
12 |
-
return f"Prediction: {label} (Confidence: {score:.2f})"
|
13 |
|
14 |
-
|
15 |
-
fn=
|
16 |
-
inputs=gr.Audio(type="filepath"),
|
17 |
outputs="text",
|
18 |
-
title="
|
19 |
-
description="
|
20 |
-
)
|
21 |
-
|
22 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load audio classification pipeline with an open model
|
5 |
model = pipeline("audio-classification", model="motheecreator/Deepfake-audio-detection")
|
6 |
|
7 |
+
def detect_deepfake(audio):
|
8 |
+
result = model(audio)[0]
|
9 |
+
label = result['label']
|
10 |
+
score = result['score']
|
11 |
+
return f"{label} ({round(score * 100, 2)}%)"
|
|
|
12 |
|
13 |
+
gr.Interface(
|
14 |
+
fn=detect_deepfake,
|
15 |
+
inputs=gr.Audio(type="filepath", label="Upload a voice clip"),
|
16 |
outputs="text",
|
17 |
+
title="AI Voice Detector",
|
18 |
+
description="This tool uses a trained AI model to detect whether a voice clip is real or AI-generated."
|
19 |
+
).launch()
|
|
|
|