File size: 581 Bytes
d2686f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

# Load the model using pipeline
pipe = pipeline("audio-classification", model="MelodyMachine/Deepfake-audio-detection-V2")

# Define the prediction function
def predict(audio):
    return pipe(audio)

# Create the Gradio interface
iface = gr.Interface(
    fn=predict,
    inputs=gr.Audio(source="microphone", type="filepath"),
    outputs="label",
    title="Deepfake Audio Detection",
    description="Upload an audio file or record your voice to detect if the audio is a deepfake."
)

# Launch the interface
iface.launch()