djkesu commited on
Commit
77c96db
1 Parent(s): f90475c

Started saving latents during voice creation

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -1,5 +1,3 @@
1
- # AGPL: a notification must be added stating that changes have been made to that file.
2
-
3
  import os
4
  import shutil
5
  from pathlib import Path
@@ -24,7 +22,6 @@ from app_utils.funcs import (
24
  load_voice_conditionings,
25
  )
26
 
27
-
28
  LATENT_MODES = [
29
  "Tortoise original (bad)",
30
  "average per 4.27s (broken on small files)",
@@ -71,11 +68,13 @@ def main():
71
  bytes_data = uploaded_file.read()
72
  with open(f"{voices_dir}voice_sample{index}.wav", "wb") as wav_file:
73
  wav_file.write(bytes_data)
74
-
75
- #create conditioning latents and save them
76
- voice_samples, conditioning_latents = get_condi(
77
- [new_voice_name], []
78
- )
 
 
79
  st.session_state["text_input_key"] = str(randint(1000, 100000000))
80
  st.session_state["file_uploader_key"] = str(randint(1000, 100000000))
81
  st.experimental_rerun()
@@ -109,6 +108,7 @@ def main():
109
  help="Which voice preset to use.",
110
  index=1,
111
  )
 
112
  with st.expander("Advanced"):
113
  col1, col2 = st.columns(2)
114
  with col1:
@@ -126,7 +126,6 @@ def main():
126
  )
127
  sampler = st.radio(
128
  "Sampler",
129
- #SAMPLERS,
130
  ["dpm++2m", "p", "ddim"],
131
  help="Diffusion sampler. Note that dpm++2m is experimental and typically requires more steps.",
132
  index=1,
 
 
 
1
  import os
2
  import shutil
3
  from pathlib import Path
 
22
  load_voice_conditionings,
23
  )
24
 
 
25
  LATENT_MODES = [
26
  "Tortoise original (bad)",
27
  "average per 4.27s (broken on small files)",
 
68
  bytes_data = uploaded_file.read()
69
  with open(f"{voices_dir}voice_sample{index}.wav", "wb") as wav_file:
70
  wav_file.write(bytes_data)
71
+
72
+ # Generate conditioning latents and samples here
73
+ voice_samples, conditioning_latents = generate_conditioning(voices_dir)
74
+
75
+ # Save the conditioning latents and samples
76
+ save_conditioning(voices_dir, voice_samples, conditioning_latents)
77
+
78
  st.session_state["text_input_key"] = str(randint(1000, 100000000))
79
  st.session_state["file_uploader_key"] = str(randint(1000, 100000000))
80
  st.experimental_rerun()
 
108
  help="Which voice preset to use.",
109
  index=1,
110
  )
111
+
112
  with st.expander("Advanced"):
113
  col1, col2 = st.columns(2)
114
  with col1:
 
126
  )
127
  sampler = st.radio(
128
  "Sampler",
 
129
  ["dpm++2m", "p", "ddim"],
130
  help="Diffusion sampler. Note that dpm++2m is experimental and typically requires more steps.",
131
  index=1,