Skip to content

Commit

Permalink
chore(format): run black on dev (#536)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] authored Jul 5, 2024
1 parent 13e1e67 commit f1c6da9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ async def generate_voice(params: ChatTTSParams):

# zip all of the audio files together
buf = io.BytesIO()
with zipfile.ZipFile(buf, "a", compression=zipfile.ZIP_DEFLATED, allowZip64=False) as f:
with zipfile.ZipFile(
buf, "a", compression=zipfile.ZIP_DEFLATED, allowZip64=False
) as f:
for idx, wav in enumerate(wavs):
f.writestr(wav_arr_to_mp3_view(wav), f"{idx}.mp3")
logger.info("Audio generation successful.")
Expand Down
3 changes: 2 additions & 1 deletion examples/cmd/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import time
import random

import pyaudio # please install it manually
import pyaudio # please install it manually
import numpy as np
import ChatTTS

from tools.audio import batch_unsafe_float_to_int16


# 流式声音处理器
class AudioStreamer:
def __init__(self):
Expand Down
1 change: 1 addition & 0 deletions tools/audio/np.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def unsafe_float_to_int16(audio: np.ndarray) -> np.ndarray:
audio16 = audio.astype(np.int16)
return audio16


@jit
def batch_unsafe_float_to_int16(audios: list[np.ndarray]) -> list[np.ndarray]:
"""
Expand Down

0 comments on commit f1c6da9

Please sign in to comment.