mirror of
https://github.com/sortedcord/kokoro-wayland.git
synced 2026-03-07 15:44:07 +05:30
chore: Cleaned up code
This commit is contained in:
6
main.py
6
main.py
@@ -1,6 +0,0 @@
|
||||
def main():
|
||||
print("Hello from kokoro-tts!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
24
narrate.py
24
narrate.py
@@ -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()
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user