Spaces:
Runtime error
Runtime error
Yulu Fu
commited on
Commit
•
d2686f5
1
Parent(s):
51c02d3
Add Gradio interface for deepfake audio detection
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the model using pipeline
|
5 |
+
pipe = pipeline("audio-classification", model="MelodyMachine/Deepfake-audio-detection-V2")
|
6 |
+
|
7 |
+
# Define the prediction function
|
8 |
+
def predict(audio):
|
9 |
+
return pipe(audio)
|
10 |
+
|
11 |
+
# Create the Gradio interface
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=predict,
|
14 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
15 |
+
outputs="label",
|
16 |
+
title="Deepfake Audio Detection",
|
17 |
+
description="Upload an audio file or record your voice to detect if the audio is a deepfake."
|
18 |
+
)
|
19 |
+
|
20 |
+
# Launch the interface
|
21 |
+
iface.launch()
|