Spaces:
Runtime error
Runtime error
modify
Browse files
app.py
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
-
import gradio as gr
|
2 |
import base64
|
3 |
import torch
|
4 |
import io
|
|
|
5 |
import scipy.io.wavfile as wavfile
|
6 |
-
from PIL import Image
|
7 |
-
import numpy as np
|
8 |
-
|
9 |
import commons
|
10 |
import utils
|
|
|
|
|
|
|
|
|
|
|
11 |
from models import SynthesizerTrn
|
12 |
from text.symbols import symbols
|
13 |
from text import text_to_sequence
|
14 |
|
15 |
-
import subprocess
|
16 |
-
import os
|
17 |
-
import tempfile
|
18 |
-
|
19 |
def get_text(text, hps):
|
20 |
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
21 |
if hps.data.add_blank:
|
@@ -49,13 +47,7 @@ net_g = SynthesizerTrn(
|
|
49 |
hps.train.segment_size // hps.data.hop_length,
|
50 |
**hps.model)
|
51 |
_ = net_g.eval()
|
52 |
-
|
53 |
-
if os.path.isfile(pretrained_model):
|
54 |
-
_ = utils.load_checkpoint(pretrained_model, net_g, None)
|
55 |
-
else:
|
56 |
-
# Run the shell script
|
57 |
-
subprocess.call('./startup.sh', shell=True)
|
58 |
-
_ = utils.load_checkpoint(pretrained_model, net_g, None)
|
59 |
|
60 |
# Define the function that will be used to generate speech from text
|
61 |
def generate_speech(text):
|
|
|
|
|
1 |
import base64
|
2 |
import torch
|
3 |
import io
|
4 |
+
import tempfile
|
5 |
import scipy.io.wavfile as wavfile
|
|
|
|
|
|
|
6 |
import commons
|
7 |
import utils
|
8 |
+
|
9 |
+
import gradio as gr
|
10 |
+
import numpy as np
|
11 |
+
|
12 |
+
from PIL import Image
|
13 |
from models import SynthesizerTrn
|
14 |
from text.symbols import symbols
|
15 |
from text import text_to_sequence
|
16 |
|
|
|
|
|
|
|
|
|
17 |
def get_text(text, hps):
|
18 |
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
19 |
if hps.data.add_blank:
|
|
|
47 |
hps.train.segment_size // hps.data.hop_length,
|
48 |
**hps.model)
|
49 |
_ = net_g.eval()
|
50 |
+
_ = utils.load_checkpoint(pretrained_model, net_g, None)
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
# Define the function that will be used to generate speech from text
|
53 |
def generate_speech(text):
|