Update app.py
Browse files
app.py
CHANGED
@@ -1,51 +1,3 @@
|
|
1 |
-
import subprocess
|
2 |
-
import sys
|
3 |
-
|
4 |
-
# Function to install a package if not already installed
|
5 |
-
def install_package(package):
|
6 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
|
7 |
-
|
8 |
-
# Install Rust compiler if not present
|
9 |
-
def install_rust():
|
10 |
-
try:
|
11 |
-
subprocess.check_call(["rustc", "--version"])
|
12 |
-
except subprocess.CalledProcessError:
|
13 |
-
subprocess.check_call(["curl", "--proto", "=https", "--tlsv1.2", "-sSf", "https://sh.rustup.rs", "|", "sh"])
|
14 |
-
|
15 |
-
# List of required packages
|
16 |
-
required_packages = [
|
17 |
-
"transformers==4.10.3",
|
18 |
-
"datasets",
|
19 |
-
"huggingface-hub>=0.19",
|
20 |
-
"hf-transfer>=0.1.4",
|
21 |
-
"protobuf<4",
|
22 |
-
"click<8.1",
|
23 |
-
"pydantic~=1.0",
|
24 |
-
"librosa==0.8.1",
|
25 |
-
"torch==2.2.0",
|
26 |
-
"torchaudio==2.2.0",
|
27 |
-
"scipy",
|
28 |
-
"Cython==0.29.21",
|
29 |
-
"phonemizer==2.2.1",
|
30 |
-
"scikit-learn",
|
31 |
-
"matplotlib",
|
32 |
-
"gradio==3.1.4",
|
33 |
-
"sentencepiece",
|
34 |
-
"sacremoses",
|
35 |
-
"tokenizers==0.10.3",
|
36 |
-
"resampy>=0.2.2",
|
37 |
-
"numba>=0.43.0",
|
38 |
-
"soundfile>=0.10.2",
|
39 |
-
"pooch>=1.0",
|
40 |
-
"decorator>=3.0.0",
|
41 |
-
"joblib>=0.14",
|
42 |
-
"audioread>=2.0.0"
|
43 |
-
]
|
44 |
-
|
45 |
-
# Install all required packages
|
46 |
-
for package in required_packages:
|
47 |
-
install_package(package)
|
48 |
-
|
49 |
import gradio as gr
|
50 |
import torch
|
51 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
@@ -80,5 +32,4 @@ iface = gr.Interface(
|
|
80 |
)
|
81 |
|
82 |
if __name__ == "__main__":
|
83 |
-
install_rust()
|
84 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
|
|
32 |
)
|
33 |
|
34 |
if __name__ == "__main__":
|
|
|
35 |
iface.launch()
|