Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5f3a4edd7 | ||
|
|
83841ef6b2 | ||
|
|
ef7219a952 | ||
|
|
91d65a6bfb | ||
|
|
5581960eee | ||
|
|
5a6cabd3db | ||
|
|
a9ec303f3f |
@ -64,10 +64,10 @@ spec:
|
|||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 32m
|
cpu: 64m
|
||||||
memory: 32Mi
|
memory: 64Mi
|
||||||
limits:
|
limits:
|
||||||
cpu: 75m
|
cpu: 128m
|
||||||
memory: 64Mi
|
memory: 64Mi
|
||||||
securityContext:
|
securityContext:
|
||||||
capabilities:
|
capabilities:
|
||||||
|
|||||||
@ -18,17 +18,18 @@ 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 {}".format(tweet), 'INFO')
|
log("Receiving Tweet to classify [{}] for [{}]".format(tweet, syncId), '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'])
|
@app.route('/sentimentProbeTest', methods=['GET'])
|
||||||
def sentimentProbeTrst():
|
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'}
|
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():
|
||||||
@ -42,7 +43,7 @@ def callProbes():
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
setup_logging()
|
setup_logging()
|
||||||
|
|
||||||
log("Starting Spam Filter...", 'INFO')
|
log("Starting Sentiment Analyser...", 'INFO')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
Thread(target=callProbes).start()
|
Thread(target=callProbes).start()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user