|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
|
|
model_pipeline = pipeline("audio-classification", model="Kabatubare/ast_celeb_spoof") |
|
|
|
def predict_voice(audio_file): |
|
predictions = model_pipeline(audio_file.name) |
|
|
|
formatted_predictions = [f"Label: {prediction['label']}, Confidence: {prediction['score']:.4f}" for prediction in predictions] |
|
return "\n".join(formatted_predictions) |
|
|
|
|
|
iface = gr.Interface( |
|
fn=predict_voice, |
|
inputs=gr.Audio(source="upload", type="file", label="Upload Audio File"), |
|
outputs=gr.Text(label="Predictions"), |
|
title="Voice Authenticity Detection", |
|
description="This model detects whether a voice is real or AI-generated. Upload an audio file to get started.", |
|
allow_flagging="never", |
|
theme="huggingface" |
|
) |
|
|
|
|
|
iface.launch() |
|
|