This commit is contained in:
Milo 2019-04-06 14:35:48 +02:00
parent 1399307500
commit 21fa94bade
4 changed files with 14 additions and 7 deletions

View file

@ -4,15 +4,13 @@ FIRST_RUN=$?
# Create and enter virtual environment
if (( $FIRST_RUN )); then
echo Creating virtual environment
python3 -m venv venv
python3.7 -m venv venv
fi
source venv/bin/activate
# Install required python packages
if (( $FIRST_RUN )); then
echo Installing required Python packages
pip install -Ur requirements.txt
fi
function run() {
python -m nightr

View file

@ -7,8 +7,8 @@ from typing import List
import requests_cache
from flask import Flask, jsonify
from server.nightr.strategies import dmi, steam
from server.nightr.util import Context
from strategies import dmi, steam, miloStrats
import Context
app = Flask(__name__)
@ -19,6 +19,8 @@ strategies = {
# name: (weight, probability function)
"dmi": (0.5, dmi.probability),
"steam": (1.0, steam.probability),
"australia" : (0.5, miloStrats.australiaStrat),
"camera" : (0.5, miloStrats.camImgStrat),
}

View file

@ -5,6 +5,9 @@ from server.nightr.util import Context, Prediction
def camImgStrat(context : Context) -> Prediction:
"""
The contents of the camera image
"""
img = cv2.imread('night.jpg',0)
average = img.mean(axis=0).mean(axis=0)
print(average)
@ -18,6 +21,9 @@ def camImgStrat(context : Context) -> Prediction:
return p
def australiaStrat(context : Context) -> Prediction:
"""
Time in Australia
"""
australia = timezone('Australia/Melbourne')
t = datetime.now().astimezone(australia)
hour = t.hour

View file

@ -1,3 +1,4 @@
Flask==1.0.2
requests==2.21.0
requests-cache==0.4.13
pytz