stuff
This commit is contained in:
parent
1399307500
commit
21fa94bade
|
@ -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
|
||||
echo Installing required Python packages
|
||||
pip install -Ur requirements.txt
|
||||
|
||||
function run() {
|
||||
python -m nightr
|
||||
|
|
|
@ -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),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Flask==1.0.2
|
||||
requests==2.21.0
|
||||
requests-cache==0.4.13
|
||||
pytz
|
Loading…
Reference in New Issue
Block a user