Spaces:
Sleeping
Sleeping
tayyardurden
commited on
Commit
•
3bc0ed3
1
Parent(s):
3c874ee
Upload 2 files
Browse files- app.py +11 -19
- requirements.txt +2 -2
app.py
CHANGED
@@ -3,7 +3,6 @@ import streamlit as st
|
|
3 |
import time
|
4 |
import os
|
5 |
|
6 |
-
|
7 |
os.environ['COQUI_TOS_AGREED'] = '1'
|
8 |
os.environ['BARK_TOS_AGREED'] = '1'
|
9 |
|
@@ -19,11 +18,9 @@ def model_coqui():
|
|
19 |
|
20 |
# @st.cache_resource()
|
21 |
def model_bark():
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
return processor, model
|
27 |
|
28 |
|
29 |
col1, col2 = st.columns(2)
|
@@ -59,19 +56,14 @@ if speaker:
|
|
59 |
st.audio(output_path_coqui, format="audio/mp3")
|
60 |
|
61 |
with col22:
|
|
|
|
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
start_time_bark = time.time() # Start the timer
|
68 |
-
audio_array = model.generate(**inputs)
|
69 |
-
end_time = time.time() # End the timer
|
70 |
-
|
71 |
-
audio_array = audio_array.cpu().numpy().squeeze()
|
72 |
-
sample_rate = model.generation_config.sample_rate
|
73 |
|
74 |
-
execution_time = round(end_time - start_time_bark,2)
|
75 |
-
st.write(f"Bark
|
76 |
|
77 |
-
st.audio(
|
|
|
3 |
import time
|
4 |
import os
|
5 |
|
|
|
6 |
os.environ['COQUI_TOS_AGREED'] = '1'
|
7 |
os.environ['BARK_TOS_AGREED'] = '1'
|
8 |
|
|
|
18 |
|
19 |
# @st.cache_resource()
|
20 |
def model_bark():
|
21 |
+
device = "cpu"
|
22 |
+
tts = TTS("tts_models/multilingual/multi-dataset/bark").to(device)
|
23 |
+
return tts
|
|
|
|
|
24 |
|
25 |
|
26 |
col1, col2 = st.columns(2)
|
|
|
56 |
st.audio(output_path_coqui, format="audio/mp3")
|
57 |
|
58 |
with col22:
|
59 |
+
tts_bark = model_bark()
|
60 |
+
speaker_wav_2 = "speaker_embeddings/tr_speaker_0"
|
61 |
|
62 |
+
start_time_bark = time.time()
|
63 |
+
output_path_bark = tts_bark.tts_to_file(text=sentence, speaker_wav=speaker_wav_2)
|
64 |
+
end_time = time.time()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
+
execution_time = round(end_time - start_time_bark,2)
|
67 |
+
st.write(f"Bark içi tamamlanma süresi: {execution_time} saniye")
|
68 |
|
69 |
+
st.audio(output_path_bark, format="audio/mp3")
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
streamlit
|
2 |
-
TTS
|
3 |
-
torch
|
|
|
1 |
streamlit
|
2 |
+
git+https://github.com/coqui-ai/TTS
|
3 |
+
torch
|