fixed cam img strat again
This commit is contained in:
parent
8cf08d6719
commit
8dc3c9ac2c
|
@ -85,7 +85,6 @@ def probabilities():
|
||||||
# If this prediction disagrees with the consensus it contributed negatively
|
# If this prediction disagrees with the consensus it contributed negatively
|
||||||
if prediction["night"] != night:
|
if prediction["night"] != night:
|
||||||
prediction["contribution"] *= -1
|
prediction["contribution"] *= -1
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"predictions": predictions,
|
"predictions": predictions,
|
||||||
"weighted_probabilities_mean": mean,
|
"weighted_probabilities_mean": mean,
|
||||||
|
|
|
@ -11,15 +11,18 @@ def camImgStrat(context : Context) -> Prediction:
|
||||||
The contents of the camera image
|
The contents of the camera image
|
||||||
"""
|
"""
|
||||||
img = context.image
|
img = context.image
|
||||||
average = img.mean()
|
average = float(img.mean())
|
||||||
p = Prediction()
|
p = Prediction()
|
||||||
p.weight = 0.7
|
p.weight = 1.0
|
||||||
if average < 100:
|
|
||||||
p.probability = 1.0
|
p.probability = 1 - round((average/255),3)
|
||||||
|
if average < 128:
|
||||||
|
p.weight = round(1 - (average/255), 3)
|
||||||
p.reasons.append('Image was dark')
|
p.reasons.append('Image was dark')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
p.weight = round(average / 255, 3)
|
||||||
p.reasons.append('Image was light')
|
p.reasons.append('Image was light')
|
||||||
p.probability = 0.0
|
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +48,11 @@ def tv2newsStrat(context : Context) -> Prediction:
|
||||||
"""
|
"""
|
||||||
The number of articles releases in the last few hours on TV2.dk
|
The number of articles releases in the last few hours on TV2.dk
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
print('before')
|
||||||
r = requests.get('http://mpx.services.tv2.dk/api/latest')
|
r = requests.get('http://mpx.services.tv2.dk/api/latest')
|
||||||
|
print('after')
|
||||||
|
|
||||||
data = r.json()
|
data = r.json()
|
||||||
publish_dates = [(x['pubDate'])//1000 for x in data][:10]
|
publish_dates = [(x['pubDate'])//1000 for x in data][:10]
|
||||||
delta_times = []
|
delta_times = []
|
||||||
|
|
Loading…
Reference in a new issue