Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix api/sts #154

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ def do_whisper(audio_file, model: str, beam_size: int = beam_size, task: str = "
whisper_model = models.whisper_model_base
elif model == "tiny":
whisper_model = models.whisper_model_tiny
else:
raise NotImplementedError(model)

processor_task = f'<|{task}|>'
first_time_start = datetime.datetime.now()
Expand Down Expand Up @@ -1482,10 +1484,8 @@ async def sts(request: Request, audio_file: UploadFile, response: Response,
translate)

# Do TTS
response = do_tts(results, 'FLAC', speaker)
fake_filename = f'tts.{format}'
media_type = mimetypes.types_map[fake_filename]
return StreamingResponse(response, media_type=media_type[0])
response, media_type = do_tts(results, 'FLAC', speaker)
return StreamingResponse(response, media_type=media_type)

class Speaker(BaseModel):
message: str
Expand Down