Spaces:
Runtime error
Runtime error
Update app.py
Browse files14 unmodified lines1516171819202122233 unmodified lines27282930313233343536373815 unmodified lines5455565758592 unmodified lines62636465666768697014 unmodified linesnp.random.seed(seed)model = ChatterboxTTS.from_pretrained(DEVICE)def generate(text, audio_prompt_path, exaggeration, pace, temperature, seed_num, cfg_weight):if seed_num != 0:set_seed(int(seed_num))3 unmodified linesexaggeration=exaggeration,pace=pace,temperature=temperature,cfg_weight=cfg_weight,)return model.sr, wav.squeeze(0).numpy()with gr.Blocks() as demo:with gr.Row():with gr.Column():text = gr.Textbox(value="What does the fox say?", label="Text to synthesize")15 unmodified linesrun_btn.click(fn=generate,inputs=[text,ref_wav,exaggeration,2 unmodified linesseed_num,cfg_weight,],outputs=audio_output,)if __name__ == "__main__":demo.queue()demo.launch()14 unmodified lines151617181920212223242526273 unmodified lines313233343536373839404142434415 unmodified lines606162636465662 unmodified lines697071727374757614 unmodified linesnp.random.seed(seed)def load_model():return ChatterboxTTS.from_pretrained(DEVICE)def generate(model, text, audio_prompt_path, exaggeration, pace, temperature, seed_num, cfgw):if model is None:model = ChatterboxTTS.from_pretrained(DEVICE)if seed_num != 0:set_seed(int(seed_num))3 unmodified linesexaggeration=exaggeration,pace=pace,temperature=temperature,cfg_weight=cfgw,)return (model, (model.sr, wav.squeeze(0).numpy()))with gr.Blocks() as demo:model_state = gr.State(None) # Loaded once per session/userwith gr.Row():with gr.Column():text = gr.Textbox(value="What does the fox say?", label="Text to synthesize")15 unmodified linesrun_btn.click(fn=generate,inputs=[model_state,text,ref_wav,exaggeration,2 unmodified linesseed_num,cfg_weight,],outputs=[model_state, audio_output],)if __name__ == "__main__":demo.queue().launch()
app.py+13-7