Added AI Disabled mode
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
import requests
|
||||
from urllib.parse import urljoin
|
||||
from pyAudioAnalysis.audioTrainTest import load_model, load_model_knn, classifier_wrapper
|
||||
from utils import config
|
||||
from .abcpreprocessor import AbcPreProcessor
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
import logging
|
||||
|
||||
from pyAudioAnalysis import audioBasicIO
|
||||
from pyAudioAnalysis import MidTermFeatures
|
||||
import numpy
|
||||
if not config.DISABLE_AI:
|
||||
import tempfile
|
||||
import requests
|
||||
from urllib.parse import urljoin
|
||||
import os
|
||||
|
||||
from pyAudioAnalysis.audioTrainTest import load_model, load_model_knn, classifier_wrapper
|
||||
from pyAudioAnalysis import audioBasicIO
|
||||
from pyAudioAnalysis import MidTermFeatures
|
||||
import numpy
|
||||
|
||||
from birbnetes_iot_platform_raspberry import BirbnetesIoTPlatformStatusDriver
|
||||
|
||||
@@ -24,7 +27,7 @@ __module_name__ = "soundpreprocessor"
|
||||
__version__text__ = "1"
|
||||
|
||||
|
||||
class SoundPreProcessor(AbcPreProcessor):
|
||||
class SoundPreProcessorLegit(AbcPreProcessor):
|
||||
"""
|
||||
SoundPreProcessor class, responsible for detecting birb chirps in sound sample.
|
||||
"""
|
||||
@@ -142,3 +145,18 @@ class SoundPreProcessor(AbcPreProcessor):
|
||||
os.remove(self._temp_means_name)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
|
||||
class SoundPreProcessorDummy(AbcPreProcessor):
|
||||
|
||||
def __init__(self):
|
||||
print("AI is disabled! Initializing dummy sound pre-processor...")
|
||||
|
||||
def preprocesssignal(self, file_path) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
if config.DISABLE_AI:
|
||||
SoundPreProcessor = SoundPreProcessorDummy
|
||||
else:
|
||||
SoundPreProcessor = SoundPreProcessorLegit
|
||||
|
||||
Reference in New Issue
Block a user