Spaces:
Running
Running
Merge pull request #18 from jhj0517/add-notebook
Browse files- app.py +11 -2
- notebook/whisper-webui.ipynb +75 -0
app.py
CHANGED
|
@@ -4,6 +4,13 @@ from modules.nllb_inference import NLLBInference
|
|
| 4 |
import os
|
| 5 |
from ui.htmls import *
|
| 6 |
from modules.youtube_manager import get_ytmetas
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def open_folder(folder_path):
|
|
@@ -20,7 +27,6 @@ def on_change_models(model_size):
|
|
| 20 |
else:
|
| 21 |
return gr.Checkbox.update(visible=True, value=False, label="Translate to English?", interactive=True)
|
| 22 |
|
| 23 |
-
|
| 24 |
whisper_inf = WhisperInference()
|
| 25 |
nllb_inf = NLLBInference()
|
| 26 |
block = gr.Blocks(css=CSS).queue(api_open=False)
|
|
@@ -127,4 +133,7 @@ with block:
|
|
| 127 |
btn_openfolder.click(fn=lambda: open_folder(os.path.join("outputs", "translations")), inputs=None, outputs=None)
|
| 128 |
|
| 129 |
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import os
|
| 5 |
from ui.htmls import *
|
| 6 |
from modules.youtube_manager import get_ytmetas
|
| 7 |
+
import argparse
|
| 8 |
+
|
| 9 |
+
# Create the parser
|
| 10 |
+
parser = argparse.ArgumentParser()
|
| 11 |
+
parser.add_argument('--share', type=bool, default=False, nargs='?', const=True,
|
| 12 |
+
help='Share value')
|
| 13 |
+
args = parser.parse_args()
|
| 14 |
|
| 15 |
|
| 16 |
def open_folder(folder_path):
|
|
|
|
| 27 |
else:
|
| 28 |
return gr.Checkbox.update(visible=True, value=False, label="Translate to English?", interactive=True)
|
| 29 |
|
|
|
|
| 30 |
whisper_inf = WhisperInference()
|
| 31 |
nllb_inf = NLLBInference()
|
| 32 |
block = gr.Blocks(css=CSS).queue(api_open=False)
|
|
|
|
| 133 |
btn_openfolder.click(fn=lambda: open_folder(os.path.join("outputs", "translations")), inputs=None, outputs=None)
|
| 134 |
|
| 135 |
|
| 136 |
+
if args.share:
|
| 137 |
+
block.launch(share=True)
|
| 138 |
+
else:
|
| 139 |
+
block.launch()
|
notebook/whisper-webui.ipynb
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"source": [
|
| 6 |
+
"**This notebook has been updated in [here](https://github.com/jhj0517/Whisper-WebUI.git) !**"
|
| 7 |
+
],
|
| 8 |
+
"metadata": {
|
| 9 |
+
"id": "doKhBBXIfS21"
|
| 10 |
+
}
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"source": [
|
| 15 |
+
"#@title #Check GPU\n",
|
| 16 |
+
"#@markdown Some models may not function correctly on a CPU runtime. \n",
|
| 17 |
+
"\n",
|
| 18 |
+
"#@markdown so you should check your GPU setup before run.\n",
|
| 19 |
+
"!nvidia-smi"
|
| 20 |
+
],
|
| 21 |
+
"metadata": {
|
| 22 |
+
"id": "23yZvUlagEsx",
|
| 23 |
+
"cellView": "form"
|
| 24 |
+
},
|
| 25 |
+
"execution_count": null,
|
| 26 |
+
"outputs": []
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"cell_type": "code",
|
| 30 |
+
"execution_count": null,
|
| 31 |
+
"metadata": {
|
| 32 |
+
"id": "kNbSbsctxahq",
|
| 33 |
+
"cellView": "form"
|
| 34 |
+
},
|
| 35 |
+
"outputs": [],
|
| 36 |
+
"source": [
|
| 37 |
+
"#@title #Installation\n",
|
| 38 |
+
"#@markdown This cell will install dependencies for Whisper-WebUI!\n",
|
| 39 |
+
"!git clone https://github.com/jhj0517/Whisper-WebUI.git\n",
|
| 40 |
+
"%cd Whisper-WebUI\n",
|
| 41 |
+
"!pip install -r requirements.txt"
|
| 42 |
+
]
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"cell_type": "code",
|
| 46 |
+
"execution_count": null,
|
| 47 |
+
"metadata": {
|
| 48 |
+
"id": "PQroYRRZzQiN",
|
| 49 |
+
"cellView": "form"
|
| 50 |
+
},
|
| 51 |
+
"outputs": [],
|
| 52 |
+
"source": [
|
| 53 |
+
"#@title #Run\n",
|
| 54 |
+
"#@markdown Once the installation is complete, you can use public URL that is displayed.\n",
|
| 55 |
+
"!python app.py --share"
|
| 56 |
+
]
|
| 57 |
+
}
|
| 58 |
+
],
|
| 59 |
+
"metadata": {
|
| 60 |
+
"colab": {
|
| 61 |
+
"provenance": [],
|
| 62 |
+
"gpuType": "A100"
|
| 63 |
+
},
|
| 64 |
+
"kernelspec": {
|
| 65 |
+
"display_name": "Python 3",
|
| 66 |
+
"name": "python3"
|
| 67 |
+
},
|
| 68 |
+
"language_info": {
|
| 69 |
+
"name": "python"
|
| 70 |
+
},
|
| 71 |
+
"accelerator": "GPU"
|
| 72 |
+
},
|
| 73 |
+
"nbformat": 4,
|
| 74 |
+
"nbformat_minor": 0
|
| 75 |
+
}
|