Luigi commited on
Commit
3745de9
·
1 Parent(s): aa0272d

add audio files and app,py

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.wav filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import streamlit as st
3
+
4
+ # Base folder where TTS samples are stored
5
+ BASE_DIR = "tts_smaples"
6
+
7
+ @st.cache_data
8
+ def get_providers_and_voices(base_dir: str):
9
+ """
10
+ Scan the base_dir for subfolders (providers) and .wav files under each.
11
+ Returns a dict: { provider_name: [voice_filename1.wav, ...], ... }
12
+ """
13
+ providers = {}
14
+ if not os.path.isdir(base_dir):
15
+ return providers
16
+ for provider in sorted(os.listdir(base_dir)):
17
+ prov_path = os.path.join(base_dir, provider)
18
+ if os.path.isdir(prov_path):
19
+ # List only .wav files
20
+ voices = [f for f in sorted(os.listdir(prov_path)) if f.lower().endswith(".wav")]
21
+ if voices:
22
+ providers[provider] = voices
23
+ return providers
24
+
25
+ def main():
26
+ st.set_page_config(page_title="TTS Samples Player", layout="centered")
27
+ st.title("🎵 TTS Samples Player")
28
+ st.markdown(
29
+ """
30
+ Select a TTS engine provider and a voice to play the corresponding WAV sample.
31
+ Ensure your `tts_smaples/` folder with subfolders (e.g., `azure/`, `google/`, etc.) is present in the repo.
32
+ """
33
+ )
34
+
35
+ providers = get_providers_and_voices(BASE_DIR)
36
+ if not providers:
37
+ st.warning(f"No providers found in `{BASE_DIR}`. Please ensure the folder exists with subfolders containing .wav files.")
38
+ return
39
+
40
+ # Let user pick a provider
41
+ provider_list = list(providers.keys())
42
+ provider = st.selectbox("Select TTS Provider", options=provider_list)
43
+
44
+ # List voices for the chosen provider
45
+ voices = providers.get(provider, [])
46
+ if not voices:
47
+ st.info(f"No .wav files found under provider `{provider}`.")
48
+ return
49
+
50
+ voice = st.selectbox("Select Voice", options=voices)
51
+
52
+ if voice:
53
+ file_path = os.path.join(BASE_DIR, provider, voice)
54
+ if os.path.isfile(file_path):
55
+ try:
56
+ # Read as bytes
57
+ audio_bytes = open(file_path, "rb").read()
58
+ st.audio(audio_bytes, format="audio/wav")
59
+ st.markdown(f"**Playing**: `{provider}/{voice}`")
60
+ except Exception as e:
61
+ st.error(f"Error loading audio file `{file_path}`: {e}")
62
+ else:
63
+ st.error(f"File not found: `{file_path}`")
64
+
65
+ # Optionally, show all providers in expanders with buttons:
66
+ with st.expander("Browse all providers/voices"):
67
+ for prov, voice_files in providers.items():
68
+ with st.expander(prov, expanded=False):
69
+ for vf in voice_files:
70
+ col1, col2 = st.columns([3,1])
71
+ col1.write(vf)
72
+ play_btn = col2.button(f"Play", key=f"{prov}_{vf}")
73
+ if play_btn:
74
+ path = os.path.join(BASE_DIR, prov, vf)
75
+ if os.path.isfile(path):
76
+ try:
77
+ data = open(path, "rb").read()
78
+ st.audio(data, format="audio/wav")
79
+ st.write(f"**Playing**: `{prov}/{vf}`")
80
+ except Exception as ex:
81
+ st.error(f"Error: {ex}")
82
+ else:
83
+ st.error(f"Not found: {path}")
84
+
85
+ if __name__ == "__main__":
86
+ main()
tts_smaples/azure/HsiaoChen.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7d2a64755b42b627ee63d9bdbf3db01afe6e3742584968943f67c87e2617395
3
+ size 1987278
tts_smaples/azure/HsiaoYu.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86fb8d1d89d9857075b7303fde68c8d9a64e473179607ca3a0a5e69d85be6a83
3
+ size 1872078
tts_smaples/azure/YunJhe.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0887db059c6ae029a2a0cf36641f65ba758d96a89fc4f92c7be4f7efaebc70b
3
+ size 1852878
tts_smaples/google/Sulafat.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93c2a963ef84eb16ad45fee6fc7de70649effdfaaaf796fc14da75d031571770
3
+ size 1968078
tts_smaples/openai/Nova.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed3e30d863d56192e1d749703c98568917c5bf4dc7dd241dd8a7be1fd0f44a74
3
+ size 1939278
tts_smaples/yating/Yating.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea96b62e033d7613e7993697bcacc64bd4de4a04bd7abc1d3009115dd6a47605
3
+ size 1939278