mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39: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
|
OUTPUT_TYPE = TitleSummary
|
||||||
|
|
||||||
async def _push(self, data: AudioDiarizationInput):
|
async def _push(self, data: AudioDiarizationInput):
|
||||||
|
try:
|
||||||
|
self.logger.info("Diarization started", audio_file_url=data.audio_url)
|
||||||
diarization = await self._diarize(data)
|
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)
|
# now reapply speaker to topics (if any)
|
||||||
# topics is a list[BaseModel] with an attribute words
|
# topics is a list[BaseModel] with an attribute words
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ class AudioDiarizationModalProcessor(AudioDiarizationProcessor):
|
|||||||
"audio_file_url": data.audio_url,
|
"audio_file_url": data.audio_url,
|
||||||
"timestamp": 0,
|
"timestamp": 0,
|
||||||
}
|
}
|
||||||
self.logger.info("Diarization started", audio_file_url=data.audio_url)
|
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
try:
|
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
self.diarization_url,
|
self.diarization_url,
|
||||||
headers=self.headers,
|
headers=self.headers,
|
||||||
@@ -32,11 +30,7 @@ class AudioDiarizationModalProcessor(AudioDiarizationProcessor):
|
|||||||
timeout=None,
|
timeout=None,
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
self.logger.info("Diarization finished")
|
|
||||||
return response.json()["text"]
|
return response.json()["text"]
|
||||||
except Exception:
|
|
||||||
self.logger.exception("Diarization failed after retrying")
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
AudioDiarizationAutoProcessor.register("modal", AudioDiarizationModalProcessor)
|
AudioDiarizationAutoProcessor.register("modal", AudioDiarizationModalProcessor)
|
||||||
|
|||||||
Reference in New Issue
Block a user