chore: Cleaned up code

This commit is contained in:
2026-02-11 19:58:40 +05:30
parent c2b953529e
commit 4543c8a48c
3 changed files with 2 additions and 30 deletions

View File

@@ -1,6 +0,0 @@
def main():
print("Hello from kokoro-tts!")
if __name__ == "__main__":
main()

View File

@@ -1,24 +0,0 @@
import sounddevice as sd
from kokoro import KPipeline
import torch
# Check if we are actually using your RTX 3050
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Using device: {device}")
# Initialize pipeline with the specific Python 3.12 environment
pipeline = KPipeline(lang_code="a", device=device)
text = """
The RTX 3050 is now narrating this documentation.
Using uv and Python 3.12 ensures that we avoid the build errors
commonly found on Arch Linux's bleeding-edge Python 3.14.
"""
# Generating audio
generator = pipeline(text, voice="af_heart", speed=1.1)
for i, (gs, ps, audio) in enumerate(generator):
print(f"Playing chunk {i}...")
sd.play(audio, samplerate=24000)
sd.wait()

View File

@@ -16,6 +16,8 @@ if not text:
print("Selection is empty.")
sys.exit(0)
text.replace("\n", ".")
print(f"Narrating: {text[:50]}...")
# 2. Setup Kokoro (GPU)