Jimmy Vu commited on
Commit
dc57c3d
·
1 Parent(s): 2e99c77

Add automatically downloading (full) unidic for Japanese

Browse files
Files changed (2) hide show
  1. gradio_app.py +12 -0
  2. requirements.txt +1 -3
gradio_app.py CHANGED
@@ -1,7 +1,10 @@
1
  import os
 
2
  import time
3
  import uuid
4
  import hashlib
 
 
5
  from pathlib import Path
6
 
7
  import gradio as gr
@@ -87,6 +90,15 @@ def load_model():
87
 
88
  load_model()
89
 
 
 
 
 
 
 
 
 
 
90
  default_speaker_reference_audio = os.path.join(sample_audio_dir, 'harvard.wav')
91
 
92
  @spaces.GPU
 
1
  import os
2
+ import sys
3
  import time
4
  import uuid
5
  import hashlib
6
+ import site
7
+ import subprocess
8
  from pathlib import Path
9
 
10
  import gradio as gr
 
90
 
91
  load_model()
92
 
93
+ def download_unidic():
94
+ site_package_path = site.getsitepackages()[0]
95
+ unidic_path = os.path.join(site_package_path, "unidic", "dicdir")
96
+ if not os.path.exists(unidic_path):
97
+ logger.info("Downloading unidic...")
98
+ subprocess.call([sys.executable, "-m", "unidic", "download"])
99
+
100
+ download_unidic()
101
+
102
  default_speaker_reference_audio = os.path.join(sample_audio_dir, 'harvard.wav')
103
 
104
  @spaces.GPU
requirements.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  gradio==4.44.1
2
  deepfilternet==0.5.6
3
  underthesea==6.8.0
@@ -7,6 +8,3 @@ pyvi
7
  langdetect
8
  cutlet
9
  unidic
10
- # for Japanese
11
- # python -m unidic download
12
- git+https://github.com/quangvu3/coqui-xtts.git
 
1
+ git+https://github.com/quangvu3/coqui-xtts.git
2
  gradio==4.44.1
3
  deepfilternet==0.5.6
4
  underthesea==6.8.0
 
8
  langdetect
9
  cutlet
10
  unidic