Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
New api support.
Browse files Browse the repository at this point in the history
  • Loading branch information
go committed Jun 28, 2019
1 parent 01034a5 commit 3c952e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def smart_filter(tweets, smart_project_id, threshold_score):
"""
# apply smart filter
request_data = [{'text': t['text']} for t in tweets] # leave only text field to speed up data transfer
predictions = heartex.api.run_predict(token=token, project=smart_project_id, data=request_data).json()
predictions = heartex.api.run_predict(token=token, project=smart_project_id, data=request_data).json()['results']

# take only relevant tweets
new_tweets = []
Expand Down Expand Up @@ -137,9 +137,9 @@ def heartex_build_plot(data, threshold_score=0.5, period='1D'):
request_data.append({'text': reply})

# heartex predict
predictions = heartex.api.run_predict(token=token, project=sentiment_project_id, data=request_data).json()
predictions = heartex.api.run_predict(token=token, project=sentiment_project_id, data=request_data).json()['results']
if not isinstance(predictions, list):
log.warning('No predictions by ML backend returned')
log.warning('No predictions by ML backend returned: ' + str(predictions))
raise Exception('No predictions by ML backend returned')

# unpack tasks back
Expand Down

0 comments on commit 3c952e0

Please sign in to comment.