import gradio as gr from transformers import pipeline # This tells the Space to load your exact model! classifier = pipeline("audio-classification", model="selva58/ai-voice-detector") def analyze_audio(audio_path): if audio_path is None: return {"error": "No audio provided"} try: # Run the model result = classifier(audio_path) return result except Exception as e: return {"error": str(e)} # Create the Gradio interface (which automatically creates an API) iface = gr.Interface( fn=analyze_audio, inputs=gr.Audio(type="filepath"), outputs="json", title="AI Voice Detector API" ) iface.launch()