Downloads · 30 days
0
LaabhGupta/voice-antispoofing
voice-antispoofing is a machine learning model from LaabhGupta. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
[](https://www.python.org/) [](https://pytorch.org/) [](https://fastapi.tiangolo.com/) [](https://reactjs.org/)
Downloads · 30 days
0
Access
Public
Updated Jul 10, 2026
Repo size
715 MB
Likes
0
Public
Click a slice to open those files.
.pth715 MB · 100%
From the Hugging Face model README
This repository contains a complete deep learning project for detecting AI-generated (spoofed) voices. The system is built on a robust workflow that includes data preprocessing, comparative model training, advanced fine-tuning, and deployment into interactive full-stack web applications.
The core of the project is a comparative study between multiple deep learning architectures to determine the most effective approach for audio anti-spoofing.
<!-- It's highly recommended to add a screenshot of your running web app here! -->
The project's development is documented across four Jupyter notebooks, each serving a specific purpose in the workflow.
FakeVsReal_1.ipynb: The initial exploratory notebook. This was used for early-stage development, prototyping the basic data loading pipeline, and training a simple CNN on a smaller subset of the data (for-rerec dataset) to ensure the core concepts were viable.
SamplingDataset.ipynb: A utility notebook created to solve a practical problem. Its purpose is to create a smaller, representative subset of the massive for-original dataset. This allows for rapid prototyping and debugging of models without waiting hours for training on the full dataset.
FakeVsReal_2.ipynb: The main initial training script. This notebook scales up the process by training all three models (Baseline CNN, Deeper CNN, ViT) from scratch on the full, large for-original dataset. The trained models from this stage are saved (..._model.pth) for the next step.
FakeVsReal_2_FineTunning.ipynb: The final and most important stage. This notebook loads the initially trained models and fine-tunes them for a few more epochs using advanced techniques like data augmentation and a lower learning rate. This step is crucial for combating overfitting and significantly improving the models' final performance. The final, production-ready models (..._finetuned.pth) are saved from this notebook.
The final test accuracies for the fine-tuned models on the unseen test set are as follows:
| Model | Test Accuracy |
|---|---|
| Fine-Tuned Baseline CNN | 99.51% |
| Fine-Tuned Deeper CNN | 99.63% |
| Fine-Tuned ViT | 99.75% |
To make the trained AI model accessible to everyone, a full-stack web application was developed and deployed.
https://voiceantispoofing.netlify.app/
https://github.com/Laabh-Gupta/Voice-Anti-Spoofing-Web-App
Follow these steps to set up the project and run the applications locally.
git clone [https://github.com/Laabh-Gupta/Fake_Vs_Real_Voice_Detection.git](https://github.com/Laabh-Gupta/Fake_Vs_Real_Voice_Detection.git)
cd Fake_Vs_Real_Voice_Detection
This project uses "The Fake or Real Dataset" from Kaggle.
for-original.zip file.FakeVsRealDataset(for-original) folder inside the root of your cloned project directory.This project uses Conda to manage backend dependencies.
A. Create the Conda Environment:
This command creates a new environment named fastapi_env with all the necessary libraries.
conda create -n fastapi_env python=3.10
conda activate fastapi_env
B. Install Dependencies: Install all required Python packages into your new environment.
pip install "fastapi[all]" uvicorn torch torchaudio torchvision python-multipart SoundFile
Note: If you have a CUDA-enabled GPU, you may want to install a specific PyTorch version that supports it. Visit the PyTorch website for the correct command.
The frontend requires Node.js and npm.
A. Navigate to a Frontend Directory: Choose one of the frontend applications to set up first.
# Example for the Baseline CNN frontend
cd "Baseline Web App/audio_classifier_app_baseline"
B. Install Dependencies: This command installs all the necessary React packages.
npm install
Repeat this step for the "ViT Web App/audio-classifier-frontend" directory as well.
To run an application, you must start both its backend and frontend servers simultaneously in two separate terminals.
conda activate fastapi_env
cd "Baseline Web App/audio_app_baseline"
uvicorn main:app --reload
Your AI backend is now running at http://127.0.0.1:8000.cd "Baseline Web App/audio_classifier_app_baseline"
npm start
Your browser will automatically open to http://localhost:3000, where you can use the application.Note on Model Choice: While both applications are fully functional, the Baseline Model Application is recommended as it is the most accurate model practically.
This project is licensed under the MIT License. See the LICENCE file for details.