File size: 4,605 Bytes
b152010
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "gpuType": "T4",
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/R3gm/SoniTranslate/blob/main/SoniTranslate_Colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# SoniTranslate\n",
        "\n",
        "| Description | Link |\n",
        "| ----------- | ---- |\n",
        "| 🎉 Repository | [![GitHub Repository](https://img.shields.io/badge/GitHub-Repository-black?style=flat-square&logo=github)](https://github.com/R3gm/SoniTranslate/) |\n",
        "| 🚀 Online Demo in HF | [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/r3gm/SoniTranslate_translate_audio_of_a_video_content) |\n",
        "\n",
        "\n"
      ],
      "metadata": {
        "id": "8lw0EgLex-YZ"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "LUgwm0rfx0_J",
        "cellView": "form"
      },
      "outputs": [],
      "source": [
        "# @title Install requirements for SoniTranslate\n",
        "!git clone https://github.com/r3gm/SoniTranslate.git\n",
        "%cd SoniTranslate\n",
        "\n",
        "!apt install git-lfs\n",
        "!git lfs install\n",
        "\n",
        "!sed -i 's|git+https://github.com/R3gm/whisperX.git@cuda_11_8|git+https://github.com/R3gm/whisperX.git@cuda_12_x|' requirements_base.txt\n",
        "!pip install -q -r requirements_base.txt\n",
        "!pip install -q -r requirements_extra.txt\n",
        "!pip install -q ort-nightly-gpu --index-url=https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ort-cuda-12-nightly/pypi/simple/\n",
        "\n",
        "Install_PIPER_TTS = True # @param {type:\"boolean\"}\n",
        "\n",
        "if Install_PIPER_TTS:\n",
        "    !pip install -q piper-tts==1.2.0\n",
        "\n",
        "Install_Coqui_XTTS = True # @param {type:\"boolean\"}\n",
        "\n",
        "if Install_Coqui_XTTS:\n",
        "    !pip install -q -r requirements_xtts.txt\n",
        "    !pip install -q TTS==0.21.1  --no-deps"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "One important step is to accept the license agreement for using Pyannote. You need to have an account on Hugging Face and `accept the license to use the models`: https://huggingface.co/pyannote/speaker-diarization and https://huggingface.co/pyannote/segmentation\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "Get your KEY TOKEN here: https://hf.co/settings/tokens"
      ],
      "metadata": {
        "id": "LTaTstXPXNg2"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "#@markdown # `RUN THE WEB APP`\n",
        "YOUR_HF_TOKEN = \"\" #@param {type:'string'}\n",
        "%env YOUR_HF_TOKEN={YOUR_HF_TOKEN}\n",
        "theme = \"Taithrah/Minimal\" # @param [\"Taithrah/Minimal\", \"aliabid94/new-theme\", \"gstaff/xkcd\", \"ParityError/LimeFace\", \"abidlabs/pakistan\", \"rottenlittlecreature/Moon_Goblin\", \"ysharma/llamas\", \"gradio/dracula_revamped\"]\n",
        "interface_language = \"english\" # @param ['arabic', 'azerbaijani', 'chinese_zh_cn', 'english', 'french', 'german', 'hindi', 'indonesian', 'italian', 'japanese', 'korean', 'marathi', 'polish', 'portuguese', 'russian', 'spanish', 'swedish', 'turkish', 'ukrainian', 'vietnamese']\n",
        "verbosity_level = \"info\" # @param [\"debug\", \"info\", \"warning\", \"error\", \"critical\"]\n",
        "\n",
        "\n",
        "%cd /content/SoniTranslate\n",
        "!python app_rvc.py --theme {theme} --verbosity_level {verbosity_level} --language {interface_language} --public_url"
      ],
      "metadata": {
        "id": "XkhXfaFw4R4J",
        "cellView": "form"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Open the `public URL` when it appears"
      ],
      "metadata": {
        "id": "KJW3KrhZJh0u"
      }
    }
  ]
}