Skip to content

Commit

Permalink
Remove create_speech() from rime synthesizer (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
adnaans authored Jun 6, 2024
1 parent 69df5bc commit e1f6fbd
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions vocode/streaming/synthesizer/rime_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,38 +142,3 @@ def get_request_body(self, text):
body["modelId"] = self.model_id

return body

async def create_speech(
self,
message: BaseMessage,
chunk_size: int,
is_first_text_chunk: bool = False,
is_sole_text_chunk: bool = False,
) -> SynthesisResult:
headers = {
"Authorization": self.api_key,
"Content-Type": "application/json",
}

body = self.get_request_body(message.text)

async with self.async_requestor.get_session().post(
self.base_url,
headers=headers,
json=body,
timeout=aiohttp.ClientTimeout(total=15),
) as response:
if not response.ok:
raise Exception(f"Rime API error: {response.status}, {await response.text()}")
data = await response.json()

audio_file = io.BytesIO(base64.b64decode(data.get("audioContent")))

result = self.create_synthesis_result_from_wav(
synthesizer_config=self.synthesizer_config,
file=audio_file,
message=message,
chunk_size=chunk_size,
)

return result

0 comments on commit e1f6fbd

Please sign in to comment.