{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "Omt6xz6ljwIR",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "Omt6xz6ljwIR",
    "outputId": "89fb352e-84a8-4d3e-b0dc-28ee9d9a3e6e"
   },
   "outputs": [],
   "source": [
    "!git clone https://github.com/rsxdalv/tts-generation-webui\n",
    "\n",
    "import os\n",
    "os.chdir(\"./tts-generation-webui\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5be2efe7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Adapted from Dockerfile\n",
    "# Install python dependencies\n",
    "# !uv pip install --no-progress --system --upgrade pip==23.3.2 setuptools\n",
    "# !uv pip install --no-progress --system torch==2.3.1 torchvision torchaudio\n",
    "!pip install uv\n",
    "!uv pip install --no-progress --system -r requirements.txt\n",
    "!uv pip install --no-progress --system -r requirements_bark_hubert_quantizer.txt\n",
    "!uv pip install --no-progress --system -r requirements_rvc.txt\n",
    "!uv pip install --no-progress --system -r requirements_audiocraft.txt\n",
    "!uv pip install --no-progress --system -r requirements_styletts2.txt\n",
    "!uv pip install --no-progress --system -r requirements_vall_e.txt\n",
    "!uv pip install --no-progress --system -r requirements_maha_tts.txt\n",
    "# !uv pip install --no-progress --system -r requirements_stable_audio.txt\n",
    "!pip install --no-progress --system -r requirements_stable_audio.txt\n",
    "# !uv pip install --no-progress --system hydra-core==1.3.2\n",
    "!uv pip install --no-progress --system nvidia-ml-py\n",
    "# !uv pip install --no-progress --system soundfile==0.12.1\n",
    "!uv pip install --no-progress --system huggingface_hub==0.25.2\n",
    "\n",
    "\n",
    "# Get latest Node.js\n",
    "# !wget https://nodejs.org/dist/v22.9.0/node-v22.9.0-linux-x64.tar.gz \n",
    "# !tar xfz node-v22.9.0-linux-x64.tar.gz \n",
    "# !cp -r node-v22.9.0-linux-x64/* /usr/local/\n",
    "\n",
    "# # Build the React UI\n",
    "# !cd react-ui && npm install && npm run build"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "r0FihjXLklZG",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "r0FihjXLklZG",
    "outputId": "77b5030b-2d12-4c20-ab0d-970b53b9ac08"
   },
   "outputs": [],
   "source": [
    "# Start the App\n",
    "!python server.py --share\n",
    "# Note - Node.js/React UI works but isn't accesssible by default on Google Colab, only gradio is easy to open."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "203e8384",
   "metadata": {},
   "outputs": [],
   "source": [
    "# (Optional) Fix for deepspeed for tortoise\n",
    "# uv pip uninstall deepspeed\n",
    "# uv pip install deepspeed==0.8.3"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3",
   "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
