Fixed accidentally not passing user-provided samples/iteration values (oops), fixed error thrown when trying to write unicode because python sucks

This commit is contained in:
mrq 2023-02-05 05:51:57 +00:00
parent cab32e1f45
commit cd94cc8459

14
app.py
View File

@ -46,6 +46,9 @@ def generate(text, emotion, prompt, voice, mic_audio, preset, seed, candidates,
'top_p': .8, 'top_p': .8,
'cond_free_k': 2.0, 'diffusion_temperature': 1.0, 'cond_free_k': 2.0, 'diffusion_temperature': 1.0,
'num_autoregressive_samples': num_autoregressive_samples,
'diffusion_iterations': diffusion_iterations,
'voice_samples': voice_samples, 'voice_samples': voice_samples,
'conditioning_latents': conditioning_latents, 'conditioning_latents': conditioning_latents,
'use_deterministic_seed': seed, 'use_deterministic_seed': seed,
@ -58,8 +61,8 @@ def generate(text, emotion, prompt, voice, mic_audio, preset, seed, candidates,
gen, additionals = tts.tts( text, **settings ) gen, additionals = tts.tts( text, **settings )
seed = additionals[0] seed = additionals[0]
info = f"{datetime.now()} | Voice: {','.join(voices)} | Text: {text} | Quality: {preset} preset / {num_autoregressive_samples} samples / {diffusion_iterations} iterations | Temperature: {temperature} | Diffusion Sampler: {diffusion_sampler} | Time Taken (s): {time.time()-start_time} | Seed: {seed}\n" info = f"{datetime.now()} | Voice: {','.join(voices)} | Text: {text} | Quality: {preset} preset / {num_autoregressive_samples} samples / {diffusion_iterations} iterations | Temperature: {temperature} | Diffusion Sampler: {diffusion_sampler} | Time Taken (s): {time.time()-start_time} | Seed: {seed}\n".encode('utf8')
with open("results.log", "a") as f: with open("results.log", "w") as f:
f.write(info) f.write(info)
timestamp = int(time.time()) timestamp = int(time.time())
@ -170,9 +173,10 @@ def main():
output_audio = gr.Audio(label="Output") output_audio = gr.Audio(label="Output")
usedSeed = gr.Textbox(label="Seed", placeholder="0", interactive=False) usedSeed = gr.Textbox(label="Seed", placeholder="0", interactive=False)
submit = gr.Button(label="Generate") submit = gr.Button(value="Generate")
#stop = gr.Button(value="Stop")
submit.click(generate, submit_event = submit.click(generate,
inputs=[ inputs=[
text, text,
emotion, emotion,
@ -190,6 +194,8 @@ def main():
outputs=[selected_voice, output_audio, usedSeed], outputs=[selected_voice, output_audio, usedSeed],
) )
#stop.click(fn=None, inputs=None, outputs=None, cancels=[submit_event])
demo.queue().launch(share=args.share) demo.queue().launch(share=args.share)