From 29c4a06d3d8af67698114ec8b77d5b830a880943 Mon Sep 17 00:00:00 2001 From: WeberJulian Date: Wed, 13 Dec 2023 11:02:26 +0100 Subject: [PATCH] Add warmup demo --- demo.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/demo.py b/demo.py index 1a56343..2ed6251 100644 --- a/demo.py +++ b/demo.py @@ -99,6 +99,20 @@ def tts(text, speaker_type, speaker_name_studio, speaker_name_custom, lang): ) if __name__ == "__main__": + print("Warming up server...") + with open("test/default_speaker.json", "r") as fp: + warmup_speaker = json.load(fp) + resp = requests.post( + SERVER_URL + "/tts", + json={ + "text": "This is a warmup request.", + "language": "en", + "speaker_embedding": warmup_speaker["speaker_embedding"], + "gpt_cond_latent": warmup_speaker["gpt_cond_latent"], + } + ) + resp.raise_for_status() + print("Starting the demo...") demo.launch( share=False, debug=False,