TroglodyteDerivations commited on
Commit
81378a3
·
verified ·
1 Parent(s): 307c042

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import torch
3
+ from tts.api import TTS
4
+ import os
5
+ os.environ["COQUI_TOS_AGREED"] = "1"
6
+
7
+ device = "cpu"
8
+
9
+ tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
10
+
11
+ def clone(text, audio='Abby_Cadabby.m4a'):
12
+ tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path="./output.wav")
13
+ return "./output.wav"
14
+
15
+ st.title('Abby Cadabby Voice Clone')
16
+ st.write("""Abby Cadabby voice clone using coqui-TTS.
17
+ Please ✨ this Space.
18
+ """)
19
+
20
+ text = st.text_input('Text', 'Type in whatever you would like me to say.')
21
+
22
+ if st.button('Generate Audio'):
23
+ audio_file = clone(text)
24
+ st.audio(audio_file)