Ahsen Khaliq commited on
Commit
3174747
1 Parent(s): 2b7bf83

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+ import zipfile
4
+ import gradio as gr
5
+
6
+ os.chdir('ParallelWaveGAN/')
7
+ os.system('pip install -e .')
8
+ os.chdir('..')
9
+ os.system('gdown https://drive.google.com/uc?id=1Flw6Z0K2QdRrTn5F-gVt6HdR9TRPiaKy')
10
+
11
+ shutil.move('VQMIVC-pretrained models/checkpoints/', '.')
12
+ shutil.move('VQMIVC-pretrained models/vocoder/', '.')
13
+
14
+ with zipfile.ZipFile('/content/VQMIVC/VQMIVC-pretrained models.zip', 'r') as zip_ref:
15
+ zip_ref.extractall('/content/VQMIVC/')
16
+
17
+ def inference(audio1, audio2):
18
+ os.system("python convert_example.py -s "+ audio1.name+" -r "+ audio2.name+ " -c converted -m 'checkpoints/useCSMITrue_useCPMITrue_usePSMITrue_useAmpTrue/VQMIVC-model.ckpt-500.pt'")
19
+ out = os.path.basename(str(audio1)).split(".")[0] + "_converted_gen.wav"
20
+ return out
21
+
22
+ inputs = [gr.inputs.Audio(label="Source Audio", type=file),gr.inputs.Audio(label="Reference Audio", type=file)]
23
+ outputs = gr.outputs.Audio(label="Output Audio", type=file)
24
+
25
+
26
+ title = "VITS"
27
+ description = "demo for VITS: Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
28
+ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2106.06103'>Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech</a> | <a href='https://github.com/jaywalnut310/vits'>Github Repo</a></p>"
29
+
30
+ examples = [
31
+ ["We propose VITS, Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech."],
32
+ ["Our method adopts variational inference augmented with normalizing flows and an adversarial training process, which improves the expressive power of generative modeling."]
33
+ ]
34
+
35
+ gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, examples=examples).launch()