Views
No views yet
sudo apt install ffmpeghttps://www.wikihow.com/Install-FFmpeg-on-Windows
- Download the ffmpeg for windows from https://github.com/GyanD/codexffmpeg/releases/download/7.1.1/ffmpeg-7.1.1-full_build-shared.7z. Please note that torchcodec works with ffmpeg version <=8.0
- Extract the zip file and copy the path to bin file within the folder.
- Add the path to ffmpeg bin files in the System Variables.1uv venv python=3.10
2source .venv/bin/activate
3uv pip install git+https://github.com/ai4bharat/IndicF5.git --torch-backend=cpu
4uv pip install torchcodec transformers==4.50.0 --torch-backend=cpu1uv venv python=3.10
2source .venv/bin/activate
3uv pip install git+https://github.com/ai4bharat/IndicF5.git
4uv pip install torchcodec transformers==4.50.0 wget https://huggingface.co/Aditya02/IndicF5/resolve/main/prompts/PAN_F_HAPPY_00001.wav1from transformers import AutoModel
2import numpy as np
3import soundfile as sf
4
5# Load IndicF5 from Hugging Face
6repo_id = "Aditya02/IndicF5"
7model = AutoModel.from_pretrained(repo_id, trust_remote_code=True)
8
9# Generate speech
10audio = model(
11 "नमस्ते! संगीत की तरह जीवन भी खूबसूरत होता है, बस इसे सही ताल में जीना आना चाहिए.",
12 ref_audio_path="PAN_F_HAPPY_00001.wav",
13 ref_text="ਭਹੰਪੀ ਵਿੱਚ ਸਮਾਰਕਾਂ ਦੇ ਭਵਨ ਨਿਰਮਾਣ ਕਲਾ ਦੇ ਵੇਰਵੇ ਗੁੰਝਲਦਾਰ ਅਤੇ ਹੈਰਾਨ ਕਰਨ ਵਾਲੇ ਹਨ, ਜੋ ਮੈਨੂੰ ਖੁਸ਼ ਕਰਦੇ ਹਨ।"
14)
15
16# Normalize and save output
17if audio.dtype == np.int16:
18 audio = audio.astype(np.float32) / 32768.0
19sf.write("namaste.wav", np.array(audio, dtype=np.float32), samplerate=24000)
20print("Audio saved succesfully.")1@misc{AI4Bharat_IndicF5_2025,
2 author = {Praveen S V and Srija Anand and Soma Siddhartha and Mitesh M. Khapra},
3 title = {IndicF5: High-Quality Text-to-Speech for Indian Languages},
4 year = {2025},
5 url = {https://github.com/AI4Bharat/IndicF5},
6}