|
82 | 82 | " )\n",
|
83 | 83 | " open(\"cmd_helper.py\", \"w\").write(r.text)\n",
|
84 | 84 | "\n",
|
85 |
| - "\n", |
86 |
| - "from notebook_utils import download_file, device_widget" |
| 85 | + "if not Path(\"pip_helper.py\").exists():\n", |
| 86 | + " r = requests.get(\n", |
| 87 | + " url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/pip_helper.py\",\n", |
| 88 | + " )\n", |
| 89 | + " open(\"pip_helper.py\", \"w\").write(r.text)" |
87 | 90 | ]
|
88 | 91 | },
|
89 | 92 | {
|
|
95 | 98 | "from pathlib import Path\n",
|
96 | 99 | "\n",
|
97 | 100 | "from cmd_helper import clone_repo\n",
|
| 101 | + "from pip_helper import pip_install\n", |
| 102 | + "import platform\n", |
98 | 103 | "\n",
|
99 | 104 | "\n",
|
100 | 105 | "repo_dir = Path(\"OpenVoice\")\n",
|
|
103 | 108 | " clone_repo(\"https://github.com/myshell-ai/OpenVoice\")\n",
|
104 | 109 | " orig_english_path = Path(\"OpenVoice/openvoice/text/_orig_english.py\")\n",
|
105 | 110 | " english_path = Path(\"OpenVoice/openvoice/text/english.py\")\n",
|
106 |
| - " \n", |
| 111 | + "\n", |
107 | 112 | " english_path.rename(orig_english_path)\n",
|
108 |
| - " \n", |
| 113 | + "\n", |
109 | 114 | " with orig_english_path.open(\"r\") as f:\n",
|
110 | 115 | " data = f.read()\n",
|
111 | 116 | " data = data.replace(\"unidecode\", \"anyascii\")\n",
|
|
116 | 121 | "# fix a problem with silero downloading and installing\n",
|
117 | 122 | "with Path(\"OpenVoice/openvoice/se_extractor.py\").open(\"r\") as orig_file:\n",
|
118 | 123 | " data = orig_file.read()\n",
|
119 |
| - " data = data.replace(\"method=\\\"silero\\\"\", \"method=\\\"silero:3.0\\\"\")\n", |
| 124 | + " data = data.replace('method=\"silero\"', 'method=\"silero:3.0\"')\n", |
120 | 125 | " with Path(\"OpenVoice/openvoice/se_extractor.py\").open(\"w\") as out_f:\n",
|
121 |
| - " out_f.write(data)\n", |
122 |
| - "\n", |
| 126 | + " out_f.write(data)\n", |
| 127 | + "\n", |
| 128 | + "\n", |
| 129 | + "pip_install(\"librosa>=0.8.1\", \"pydub>=0.25.1\", \"tqdm\", \"inflect>=7.0.0\", \"pypinyin>=0.50.0\", \"openvino>=2023.3\", \"gradio>=4.15\")\n", |
| 130 | + "pip_install(\n", |
| 131 | + " \"--extra-index-url\",\n", |
| 132 | + " \"https://download.pytorch.org/whl/cpu\",\n", |
| 133 | + " \"wavmark>=0.0.3\",\n", |
| 134 | + " \"faster-whisper>=0.9.0\",\n", |
| 135 | + " \"eng_to_ipa>=0.0.2\",\n", |
| 136 | + " \"cn2an>=0.5.22\",\n", |
| 137 | + " \"jieba>=0.42.1\",\n", |
| 138 | + " \"langid>=1.1.6\",\n", |
| 139 | + " \"ipywebrtc\",\n", |
| 140 | + " \"anyascii\",\n", |
| 141 | + " \"torch>=2.1\",\n", |
| 142 | + " \"nncf>=2.11.0\",\n", |
| 143 | + " \"dtw-python\",\n", |
| 144 | + " \"more-itertools\",\n", |
| 145 | + " \"tiktoken\",\n", |
| 146 | + ")\n", |
| 147 | + "pip_install(\"--no-deps\", \"whisper-timestamped>=1.14.2\", \"openai-whisper\")\n", |
123 | 148 | "\n",
|
124 |
| - "%pip install -q \"librosa>=0.8.1\" \"wavmark>=0.0.3\" \"faster-whisper>=0.9.0\" \"pydub>=0.25.1\" \"whisper-timestamped>=1.14.2\" \"tqdm\" \"inflect>=7.0.0\" \"eng_to_ipa>=0.0.2\" \"pypinyin>=0.50.0\" \\\n", |
125 |
| - "\"cn2an>=0.5.22\" \"jieba>=0.42.1\" \"langid>=1.1.6\" \"gradio>=4.15\" \"ipywebrtc\" \"anyascii\" \"openvino>=2023.3\" \"torch>=2.1\" \"nncf>=2.11.0\"" |
| 149 | + "if platform.system() == \"Darwin\":\n", |
| 150 | + " pip_install(\"numpy<2.0\")" |
126 | 151 | ]
|
127 | 152 | },
|
128 | 153 | {
|
|
156 | 181 | "import openvino as ov\n",
|
157 | 182 | "import ipywidgets as widgets\n",
|
158 | 183 | "from IPython.display import Audio\n",
|
| 184 | + "from notebook_utils import download_file, device_widget\n", |
159 | 185 | "\n",
|
160 | 186 | "core = ov.Core()\n",
|
161 | 187 | "\n",
|
|
0 commit comments