--- license: apache-2.0 language: - en base_model: - facebook/wav2vec2-base-960h pipeline_tag: audio-classification library_name: transformers tags: - en-IN - voice-gender-detection - male - female - SFT --- ![1](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/YB_vNyYii-CnkSTNB3eSS.png) # Common-Voice-Gender-Detection-IND-En | India (English) > **Common-Voice-Gender-Detection-IND-En** is a fine-tuned version of `facebook/wav2vec2-base-960h` for **binary audio classification**, specifically trained on **English (IND-En) speech** to detect speaker gender as **female** or **male**. This model leverages the `Wav2Vec2ForSequenceClassification` architecture for efficient and accurate voice-based gender classification. > [!note] > Wav2Vec2: Self-Supervised Learning for Speech Recognition: https://arxiv.org/pdf/2006.11477 ```py 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 ``` ![download-1](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/YYInmd59bFeJhgnJLE2qV.png) ![download-2](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/zxi8M3HeToG9IBuKHVkR0.png) --- ## Label Space: 2 Classes ```text Class 0: female Class 1: male ``` --- ## Install Dependencies ```bash pip install gradio transformers torch librosa hf_xet ``` --- ## Inference Code ```python 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() ``` --- ## Demo Inference ![Gender](https://img.shields.io/badge/Gender-Male-blue?style=plastic) ![Screenshot 2026-09-02 120946](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/RUaAfQQ7DLRz4me1Nm6qW.png) ![Gender](https://img.shields.io/badge/Gender-Female-ff69b4?style=plastic) ![gradio.live](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/RS61W8XdzZerkFqAnMhG5.png) --- ## Intended Use `Common-Voice-Gender-Detection-IND-En` is designed for: * **Speech Analytics** – Assist in analyzing speaker demographics in call centers or customer service recordings. * **Conversational AI Personalization** – Adjust tone or dialogue based on gender detection for more personalized voice assistants. * **Voice Dataset Curation** – Automatically tag or filter voice datasets by speaker gender for better dataset management. * **Research Applications** – Enable linguistic and acoustic research involving gender-specific speech patterns. * **Multimedia Content Tagging** – Automate metadata generation for gender identification in podcasts, interviews, or video content.