Compare commits

..

No commits in common. "master" and "1.0.0-b6" have entirely different histories.

3 changed files with 9 additions and 13 deletions

View File

@ -64,10 +64,10 @@ spec:
imagePullPolicy: Always imagePullPolicy: Always
resources: resources:
requests: requests:
cpu: 64m cpu: 32m
memory: 64Mi memory: 32Mi
limits: limits:
cpu: 128m cpu: 75m
memory: 64Mi memory: 64Mi
securityContext: securityContext:
capabilities: capabilities:

View File

@ -18,20 +18,15 @@ analyser = sentimentAnalyser.get_sentiment()
@app.route('/sentiment', methods=['GET']) @app.route('/sentiment', methods=['GET'])
def tweetPredict(): def tweetPredict():
tweet = request.args.get('tweet') tweet = request.args.get('tweet')
syncId = request.headers.get('X-CRYPTO-Sync-ID')
log("Receiving Tweet to classify [{}] for [{}]".format(tweet, syncId), 'INFO') log("Receiving Tweet to classify {}".format(tweet), 'INFO')
result = analyser.get_vader_sentiment(tweet) result = analyser.get_vader_sentiment(tweet)
log("Returning classification result of [{}]".format(result), 'INFO') log("Returning classification result of {}".format(result), 'INFO')
return json.dumps({'result': result, 'tweet': tweet}), 200, {'ContentType':'application/json'} return json.dumps({'result': result, 'tweet': tweet}), 200, {'ContentType':'application/json'}
@app.route('/sentimentProbeTest', methods=['GET'])
def sentimentProbeTest():
return json.dumps({'result': {'Score': {'neg': 0.0, 'neu': 1.0, 'pos': 0.0, 'compound': 0.0}, 'Compound': 0.0}, 'tweet': 'Fake Text'}), 200, {'ContentType':'application/json'}
def callSentimentAnalyser(): def callSentimentAnalyser():
analyser.set_newSentiment() analyser.set_newSentiment()
@ -43,9 +38,10 @@ def callProbes():
if __name__ == '__main__': if __name__ == '__main__':
setup_logging() setup_logging()
log("Starting Sentiment Analyser...", 'INFO') log("Starting Spam Filter...", 'INFO')
sys.stdout.flush() sys.stdout.flush()
Thread(target=callProbes).start() Thread(target=callProbes).start()
Thread(target=callSentimentAnalyser).start() Thread(target=callSentimentAnalyser).start()
# Thread(target=callNewsFilter).start()

View File

@ -13,7 +13,7 @@ def health():
@app.route('/readiness') @app.route('/readiness')
def readiness(): def readiness():
result = requests.request("GET", 'http://0.0.0.0:9090/sentimentProbeTest') result = requests.request("GET", 'http://0.0.0.0:9090/sentiment?tweet=Bitcoin%20is%20doing%20very%20well')
result = json.loads(result.text) result = json.loads(result.text)
if result != "" : if result != "" :