NeuroSenko commited on
Commit
8f40c33
1 Parent(s): da590b9

added install+start scripts; save audio into out_audio folder

Browse files
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ venv/
2
+ out_audio/*.wav
3
+ latest_silero_models.yml
README.md CHANGED
@@ -9,4 +9,8 @@ app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
9
  pinned: false
10
  ---
11
 
12
+ How to run locally using Windows:
13
+ 1. Mare sure you have installed ffmpeg in your system
14
+ 2. Clone the repo: `git clone https://huggingface.co/spaces/NeuroSenko/tts-silero`
15
+ 3. Run `install.bat`
16
+ 4. Run `start.bat`
app.py CHANGED
@@ -1,7 +1,9 @@
 
 
 
 
1
  import gradio as gr
2
  import torch
3
-
4
- # from IPython.display import Audio, display
5
  from omegaconf import OmegaConf
6
 
7
  torch.hub.download_url_to_file(
@@ -55,8 +57,12 @@ def change_model(language, model_name):
55
 
56
 
57
  def generate_audio_by_text(text, text_type, speaker):
 
 
 
58
  if text_type == 'SSML':
59
  return model.save_wav(
 
60
  ssml_text=text,
61
  speaker=speaker,
62
  sample_rate=sample_rate,
@@ -65,6 +71,7 @@ def generate_audio_by_text(text, text_type, speaker):
65
  )
66
  else:
67
  return model.save_wav(
 
68
  text=text,
69
  speaker=speaker,
70
  sample_rate=sample_rate,
 
1
+ import os
2
+ from datetime import datetime
3
+ from inspect import signature
4
+
5
  import gradio as gr
6
  import torch
 
 
7
  from omegaconf import OmegaConf
8
 
9
  torch.hub.download_url_to_file(
 
57
 
58
 
59
  def generate_audio_by_text(text, text_type, speaker):
60
+ output_file_name = "{datetime}.wav".format(datetime=datetime.now().isoformat().replace(':', '-'))
61
+ output = os.path.join("out_audio", output_file_name)
62
+
63
  if text_type == 'SSML':
64
  return model.save_wav(
65
+ audio_path=output,
66
  ssml_text=text,
67
  speaker=speaker,
68
  sample_rate=sample_rate,
 
71
  )
72
  else:
73
  return model.save_wav(
74
+ audio_path=output,
75
  text=text,
76
  speaker=speaker,
77
  sample_rate=sample_rate,
install.bat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ python -m venv ./venv
2
+ call .\venv\Scripts\activate.bat
3
+ pip install -r requirements.txt
out_audio/audio files will be placed here.txt ADDED
File without changes
start.bat ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ call .\venv\Scripts\activate.bat
2
+ python app.py