Downloads · 30 days
29
35% of all-time downloads
prithivMLmods/Common-Voice-Gender-Detection-IND-En-ONNX
Common-Voice-Gender-Detection-IND-En-ONNX is a audio classification model from prithivMLmods. Use it for the audio classification task on the model card, and read the license before you ship it in a product. It is set up for transformers.js. The card lists the license as apache-2.0.
This is an ONNX version of prithivMLmods/Common-Voice-Gender-Detection-IND-En. It was automatically converted and uploaded using this Hugging Face Space.
Downloads · 30 days
29
35% of all-time downloads
All-time downloads
82
Public
Repo size
724 MB
Likes
2
Public
Click a slice to open those files.
.onnx814 MB · 100%
From the Hugging Face model README
This is an ONNX version of prithivMLmods/Common-Voice-Gender-Detection-IND-En. It was automatically converted and uploaded using this Hugging Face Space.
See the pipeline documentation for audio-classification: https://huggingface.co/docs/transformers.js/api/pipelines#module_pipelines.AudioClassificationPipeline

Common-Voice-Gender-Detection-IND-En is a fine-tuned version of
facebook/wav2vec2-base-960hfor binary audio classification, specifically trained on English (IND-En) speech to detect speaker gender as female or male. This model leverages theWav2Vec2ForSequenceClassificationarchitecture for efficient and accurate voice-based gender classification.
[!note] Wav2Vec2: Self-Supervised Learning for Speech Recognition: https://arxiv.org/pdf/2006.11477
Classification Report:
precision recall f1-score support
Female 0.9986 0.9913 0.9950 3579
Male 0.9900 0.9984 0.9942 3077
accuracy 0.9946 6656
macro avg 0.9943 0.9949 0.9946 6656
weighted avg 0.9946 0.9946 0.9946 6656

Class 0: female
Class 1: male
pip install gradio transformers torch librosa hf_xet
import gradio as gr
from transformers import Wav2Vec2ForSequenceClassification, Wav2Vec2FeatureExtractor
import torch
import librosa
# Load model and processor
model_name = "prithivMLmods/Common-Voice-Gender-Detection-IND-En"
model = Wav2Vec2ForSequenceClassification.from_pretrained(model_name)
processor = Wav2Vec2FeatureExtractor.from_pretrained(model_name)
# Label mapping
id2label = {
"0": "female",
"1": "male"
}
def classify_audio(audio_path):
# Load and resample audio to 16kHz
speech, sample_rate = librosa.load(audio_path, sr=16000)
# Process audio
inputs = processor(
speech,
sampling_rate=sample_rate,
return_tensors="pt",
padding=True
)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
prediction = {
id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))
}
return prediction
# Gradio Interface
iface = gr.Interface(
fn=classify_audio,
inputs=gr.Audio(type="filepath", label="Upload Audio (WAV, MP3, etc.)"),
outputs=gr.Label(num_top_classes=2, label="Gender Classification"),
title="Common Voice Gender Detection - IND-En",
description="Upload an English (IND-En) speech clip to classify the speaker's gender as female or male."
)
if __name__ == "__main__":
iface.launch()
<audio controls src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/-P5gimu8tRiv82o_iHPUN.wav"></audio>

<audio controls src="https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/_9ieMr5DpVN730QTD4hyf.wav"></audio>

Common-Voice-Gender-Detection-IND-En is designed for: