Spaces:
Running
Running
tayyardurden
commited on
Commit
•
cf62e39
1
Parent(s):
9b9fb8a
Upload 6 files
Browse files- app.py +38 -0
- output.wav +0 -0
- requirements.txt +3 -0
- sounds/alp.mp3 +0 -0
- sounds/ematr.mp3 +0 -0
- sounds/glinda.mp3 +0 -0
app.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from TTS.api import TTS
|
3 |
+
import streamlit as st
|
4 |
+
import time
|
5 |
+
|
6 |
+
def settings ():
|
7 |
+
global device, tts, speaker_wav
|
8 |
+
# Get device
|
9 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
10 |
+
|
11 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
|
12 |
+
speaker_wav ="sounds/alp.mp3"
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
st.header("Bas Konuş")
|
17 |
+
st.text_input("Konuşmak istediğiniz metni girin")
|
18 |
+
speaker=st.button("Konuş")
|
19 |
+
|
20 |
+
text = """Data bank'a hoşgeldiniz. Ben asistanınız esra, size nasıl yardımcı olabilirim?"""
|
21 |
+
|
22 |
+
|
23 |
+
if speaker:
|
24 |
+
start_time = time.time() # Start the timer
|
25 |
+
|
26 |
+
settings()
|
27 |
+
output_path = tts.tts_to_file(text=text, speaker_wav=speaker_wav ,language="tr")
|
28 |
+
|
29 |
+
end_time = time.time() # End the timer
|
30 |
+
|
31 |
+
execution_time = end_time - start_time # Calculate the time taken
|
32 |
+
|
33 |
+
st.write(f"Execution time: {execution_time} seconds") # Display the time taken
|
34 |
+
|
35 |
+
st.audio(output_path, format="audio/mp3")
|
36 |
+
|
37 |
+
|
38 |
+
|
output.wav
ADDED
Binary file (352 kB). View file
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
TTS
|
3 |
+
pytorch
|
sounds/alp.mp3
ADDED
Binary file (17.1 kB). View file
|
|
sounds/ematr.mp3
ADDED
Binary file (73.6 kB). View file
|
|
sounds/glinda.mp3
ADDED
Binary file (63.1 kB). View file
|
|