Added tracing to classification
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,6 +4,7 @@ import tempfile
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import opentracing
|
||||
|
||||
import librosa
|
||||
import librosa.display
|
||||
@@ -83,10 +84,13 @@ class Classifier(object):
|
||||
|
||||
return predicted_class_name, labeled_predictions
|
||||
|
||||
def predict(self, wav_filename: str) -> Tuple[str, dict]:
|
||||
directory, _ = self.create_spectrogram(wav_filename)
|
||||
def predict(self, wav_filename: str, span: opentracing.span.Span) -> Tuple[str, dict]:
|
||||
with opentracing.tracer.start_span('createSpectrogram', child_of=span):
|
||||
directory, _ = self.create_spectrogram(wav_filename)
|
||||
|
||||
with opentracing.tracer.start_span('runPredictor', child_of=span):
|
||||
result = self._run_predictor(directory)
|
||||
|
||||
result = self._run_predictor(directory)
|
||||
shutil.rmtree(directory) # The image is no longer needed
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user