Skip to content

Commit

Permalink
Predicter class enabling caching
Browse files Browse the repository at this point in the history
  • Loading branch information
kootenpv committed Oct 8, 2017
1 parent f9afa7d commit 8afa68e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
re.sub('__version__ = "[0-9.]+"',
'__version__ = "{}"'.format(version), init))

py_version = "python3.5" if sh.which("python3.5") is not None else "python"
py_version = "python3.7" if sh.which("python3.7") is not None else "python"
os.system('{} setup.py sdist bdist_wheel upload'.format(py_version))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

MAJOR_VERSION = '0'
MINOR_VERSION = '4'
MICRO_VERSION = '70'
MICRO_VERSION = '75'
VERSION = "{}.{}.{}".format(MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION)

setup(name='whereami',
Expand Down
2 changes: 1 addition & 1 deletion whereami/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys

__project__ = "whereami"
__version__ = "0.4.70"
__version__ = "0.4.75"
__repo__ = "https://github.com/kootenpv/whereami"

from whereami.learn import learn
Expand Down
7 changes: 5 additions & 2 deletions whereami/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ def __init__(self, model=None, device=""):
self.device = device
self.clf = get_model(model)
self.wifi_scanner = get_scanner(device)
self.predicted_value = None

def predict(self):
aps = self.wifi_scanner.get_access_points()
return self.clf.predict(aps_to_dict(aps))[0]
self.predicted_value = self.clf.predict(aps_to_dict(aps))[0]
return self.predicted_value

def refresh(self):
return Predicter(self.model, self.device)
self.clf = get_model(self.model)
self.wifi_scanner = get_scanner(self.device)

0 comments on commit 8afa68e

Please sign in to comment.