AngeT10 commited on
Commit
58b2f84
1 Parent(s): d634d7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import torch
3
  import os
@@ -5,11 +15,11 @@ import zipfile
5
  import requests
6
  from TTS.api import TTS
7
 
8
- # Verifica se è disponibile una GPU, altrimenti utilizza la CPU
9
- device = "cuda" if torch.cuda.is_available() else "cpu"
10
-
11
  os.environ["COQUI_TOS_AGREED"] = "1"
12
 
 
 
 
13
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
14
 
15
  def clone(text, url, language):
@@ -30,19 +40,8 @@ def clone(text, url, language):
30
 
31
  return "./output.wav"
32
 
33
- languages = [
34
- "en", "es", "fr", "de", "it",
35
- "pt", "pl", "tr", "ru", "nl",
36
- "cs", "ar", "zh-cn", "ja", "hu",
37
- "ko", "hi"
38
- ]
39
-
40
  iface = gr.Interface(fn=clone,
41
- inputs=[
42
- gr.components.Text("", label="the text to be said"),
43
- gr.components.Text("", label="URL of the zip file with the dataset on hf.co (10 seconds is fine)!"),
44
- gr.Dropdown(choices=languages, label="Language")
45
- ],
46
  outputs=gr.Audio(type='filepath'),
47
  title='Voice Clone',
48
  description="""
 
1
+ import subprocess
2
+ import os
3
+ import torch
4
+ import urllib.request
5
+
6
+ # Set the device to CPU
7
+ device = "cpu"
8
+
9
+ os.environ["COQUI_TOS_AGREED"] = "1"
10
+
11
  import gradio as gr
12
  import torch
13
  import os
 
15
  import requests
16
  from TTS.api import TTS
17
 
 
 
 
18
  os.environ["COQUI_TOS_AGREED"] = "1"
19
 
20
+ # Set the device to CPU
21
+ device = "cpu"
22
+
23
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
24
 
25
  def clone(text, url, language):
 
40
 
41
  return "./output.wav"
42
 
 
 
 
 
 
 
 
43
  iface = gr.Interface(fn=clone,
44
+ inputs=["text", gr.components.Text(label="URL"), gr.Dropdown(choices=["en", "es", "fr", "de", "it", "pt", "pl", "tr", "ru", "nl", "cs", "ar", "zh-cn", "ja", "hu", "ko", "hi"], label="Language")],
 
 
 
 
45
  outputs=gr.Audio(type='filepath'),
46
  title='Voice Clone',
47
  description="""