diff --git a/src/probes/probes.py b/src/probes/probes.py index c99da09..4598913 100644 --- a/src/probes/probes.py +++ b/src/probes/probes.py @@ -12,17 +12,17 @@ def health(): @app.route('/readiness') def readiness(): - # result = requests.request("GET", 'http://localhost:9090/predictProbeTest') - # result = json.loads(result.text) + result = requests.request("GET", 'http://localhost:9090/predictProbeTest') + result = json.loads(result.text) - if "d" != "": + if result != "": return json.dumps({ 'status': 'UP', 'app': { 'name': 'CryptoSky spam filter', 'description': 'Projects spam filter service that classifies whether the tweet that is sent to it is spam or not', 'check_status': 'Success - Call to prediction endpoint', - 'response': "{'result': 'spam', 'tweet': 'Fake Test Tweet'}" + 'response': result } }), 200, {'ContentType': 'application/json'} else: @@ -32,7 +32,7 @@ def readiness(): 'name': 'CryptoSky spam filter', 'description': 'Projects spam filter service that classifies whether the tweet that is sent to it is spam or not', 'check_status': 'Failure - Call to prediction endpoint', - 'response': "{'result': 'spam', 'tweet': 'Fake Test Tweet'}" + 'response': result } }), 503, {'ContentType': 'application/json'} diff --git a/src/tweets/tweetFilter.py b/src/tweets/tweetFilter.py index efb8eeb..aa4c891 100644 --- a/src/tweets/tweetFilter.py +++ b/src/tweets/tweetFilter.py @@ -253,7 +253,7 @@ class tweetFilter(object): pass def tweetFilterTrain(self): - self.Filter = multinomialNaiveBayes("src/resources/tweet_spam_ham.csv") + self.Filter = multinomialNaiveBayes("/home/spam-filter/src/resources/tweet_spam_ham.csv") log("Training Filter", 'INFO') self.Filter.trainFilter()