flake8 fixes
This commit is contained in:
+1
-5
@@ -94,9 +94,6 @@ def loadMetaModel():
|
||||
|
||||
|
||||
def predictFilter(lat, lon, week):
|
||||
|
||||
global M_INTERPRETER
|
||||
|
||||
# Does interpreter exist?
|
||||
if M_INTERPRETER is None:
|
||||
loadMetaModel()
|
||||
@@ -209,7 +206,6 @@ def custom_sigmoid(x, sensitivity=1.0):
|
||||
|
||||
|
||||
def predict(sample, sensitivity):
|
||||
global INTERPRETER
|
||||
# Make a prediction
|
||||
INTERPRETER.set_tensor(INPUT_LAYER_INDEX, np.array(sample[0], dtype='float32'))
|
||||
if model == "BirdNET_6K_GLOBAL_MODEL":
|
||||
@@ -240,7 +236,7 @@ def predict(sample, sensitivity):
|
||||
|
||||
|
||||
def analyzeAudioData(chunks, lat, lon, week, sens, overlap,):
|
||||
global INTERPRETER, WEEK
|
||||
global WEEK
|
||||
|
||||
sensitivity = max(0.5, min(1.0 - (sens - 1.0), 1.5))
|
||||
|
||||
|
||||
+2
-4
@@ -11,9 +11,10 @@ try:
|
||||
except BaseException:
|
||||
from tensorflow import lite as tflite
|
||||
|
||||
M_INTERPRETER, M_INPUT_LAYER_INDEX, M_OUTPUT_LAYER_INDEX, CLASSES = (None, None, None, None)
|
||||
|
||||
|
||||
def loadMetaModel():
|
||||
|
||||
global M_INTERPRETER
|
||||
global M_INPUT_LAYER_INDEX
|
||||
global M_OUTPUT_LAYER_INDEX
|
||||
@@ -42,9 +43,6 @@ def loadMetaModel():
|
||||
|
||||
|
||||
def predictFilter(lat, lon, week):
|
||||
|
||||
global M_INTERPRETER
|
||||
|
||||
# Does interpreter exist?
|
||||
try:
|
||||
if M_INTERPRETER is None:
|
||||
|
||||
@@ -14,6 +14,7 @@ DB_PATH = userDir + '/BirdNET-Pi/scripts/birds.db'
|
||||
flickr_images = {}
|
||||
species_last_notified = {}
|
||||
|
||||
|
||||
asset = apprise.AppriseAsset(
|
||||
plugin_paths=[
|
||||
userDir + "/.apprise/plugins",
|
||||
@@ -107,13 +108,15 @@ def sendAppriseNotifications(species, confidence, confidencepct, path,
|
||||
# TODO: Make this work with non-english comnames. Implement the "// convert sci name to English name" logic from overview.php here
|
||||
headers = {'User-Agent': 'Python_Flickr/1.0'}
|
||||
url = ('https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=' + str(settings_dict.get('FLICKR_API_KEY')) +
|
||||
'&text=' + str(comName) + ' bird&sort=relevance&per_page=5&media=photos&format=json&license=2%2C3%2C4%2C5%2C6%2C9&nojsoncallback=1')
|
||||
'&text=' + str(comName) +
|
||||
' bird&sort=relevance&per_page=5&media=photos&format=json&license=2%2C3%2C4%2C5%2C6%2C9&nojsoncallback=1')
|
||||
resp = requests.get(url=url, headers=headers, timeout=10)
|
||||
|
||||
resp.encoding = "utf-8"
|
||||
data = resp.json()["photos"]["photo"][0]
|
||||
|
||||
image_url = 'https://farm'+str(data["farm"])+'.static.flickr.com/'+str(data["server"])+'/'+str(data["id"])+'_'+str(data["secret"])+'_n.jpg'
|
||||
image_url = ('https://farm' + str(data["farm"]) + '.static.flickr.com/' + str(data["server"]) + '/' +
|
||||
str(data["id"]) + '_'+str(data["secret"]) + '_n.jpg')
|
||||
flickr_images[comName] = image_url
|
||||
except Exception as e:
|
||||
print("FLICKR API ERROR: "+str(e))
|
||||
|
||||
Reference in New Issue
Block a user