diff --git "a/example.ipynb" "b/example.ipynb"
new file mode 100644--- /dev/null
+++ "b/example.ipynb"
@@ -0,0 +1,171 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Kokoro-82M ONNX Runtime Inference"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Import required libraries\n",
+ "import numpy as np\n",
+ "from IPython.display import display, Audio\n",
+ "\n",
+ "# Import the Kokoro model class\n",
+ "from models import Tokenizer, Kokoro"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "model_path = \"weights/kokoro-v0_19.onnx\"\n",
+ "output_filename = \"output.wav\"\n",
+ "style_vector_path = \"voices/af_bella.pt\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Initialize Tokenizer and Kokoro model"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "tokenizer = Tokenizer()\n",
+ "\n",
+ "kokoro = Kokoro(model_path, style_vector_path, tokenizer=tokenizer, lang='en-us')\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "text = (\n",
+ " \"This approach ensures the entire text is processed without exceeding the token limit and outputs seamless audio for the full input. \"\n",
+ " \"Let me know if you need further assistance!\"\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Generate audio"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "audio, sample_rate = kokoro.generate_audio(text, speed=1.0)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Display the output on jupyter"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " \n",
+ " "
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "display(Audio(data=audio, rate=24000, autoplay=True))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Save model the output"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Audio saved to output.wav\n"
+ ]
+ }
+ ],
+ "source": [
+ "import soundfile as sf\n",
+ "\n",
+ "sf.write(output_filename, audio, sample_rate)\n",
+ "print(f\"Audio saved to {output_filename}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "torch",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.10.14"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}