Skip to content

Commit

Permalink
Clean web demo output
Browse files Browse the repository at this point in the history
  • Loading branch information
duzx16 committed Oct 25, 2024
1 parent 4db74f9 commit 05d7267
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions web_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def inference_fn(
inputs += f"<|system|>\n{system_prompt}"
inputs += f"<|user|>\n{user_input}<|assistant|>streaming_transcription\n"

print(inputs)
with torch.no_grad():
response = requests.post(
"http://localhost:10000/generate_stream",
Expand Down Expand Up @@ -158,7 +157,6 @@ def inference_fn(
tts_speech = torch.cat(tts_speechs, dim=-1).cpu()
complete_text = glm_tokenizer.decode(complete_tokens, spaces_between_special_tokens=False)
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as f:
print(f.name)
torchaudio.save(f, tts_speech.unsqueeze(0), 22050, format="wav")
history.append({"role": "assistant", "content": {"path": f.name, "type": "audio/wav"}})
history.append({"role": "assistant", "content": glm_tokenizer.decode(text_tokens, ignore_special_tokens=False)})
Expand Down

0 comments on commit 05d7267

Please sign in to comment.