mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
server: move logging to base implementation, not specialization
This commit is contained in:
@@ -7,7 +7,13 @@ class AudioDiarizationProcessor(Processor):
|
||||
OUTPUT_TYPE = TitleSummary
|
||||
|
||||
async def _push(self, data: AudioDiarizationInput):
|
||||
diarization = await self._diarize(data)
|
||||
try:
|
||||
self.logger.info("Diarization started", audio_file_url=data.audio_url)
|
||||
diarization = await self._diarize(data)
|
||||
self.logger.info("Diarization finished")
|
||||
except Exception:
|
||||
self.logger.exception("Diarization failed after retrying")
|
||||
raise
|
||||
|
||||
# now reapply speaker to topics (if any)
|
||||
# topics is a list[BaseModel] with an attribute words
|
||||
|
||||
@@ -22,21 +22,15 @@ class AudioDiarizationModalProcessor(AudioDiarizationProcessor):
|
||||
"audio_file_url": data.audio_url,
|
||||
"timestamp": 0,
|
||||
}
|
||||
self.logger.info("Diarization started", audio_file_url=data.audio_url)
|
||||
async with httpx.AsyncClient() as client:
|
||||
try:
|
||||
response = await client.post(
|
||||
self.diarization_url,
|
||||
headers=self.headers,
|
||||
params=params,
|
||||
timeout=None,
|
||||
)
|
||||
response.raise_for_status()
|
||||
self.logger.info("Diarization finished")
|
||||
return response.json()["text"]
|
||||
except Exception:
|
||||
self.logger.exception("Diarization failed after retrying")
|
||||
raise
|
||||
response = await client.post(
|
||||
self.diarization_url,
|
||||
headers=self.headers,
|
||||
params=params,
|
||||
timeout=None,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()["text"]
|
||||
|
||||
|
||||
AudioDiarizationAutoProcessor.register("modal", AudioDiarizationModalProcessor)
|
||||
|
||||
Reference in New Issue
Block a user