The backend service has 3 main responsibilities :
- Accept requests from the mobile app
- Add the images on a queue which are fed to the model
- Write the inference results on firebase
- Flask
- Redis and RQ
- Firebase
- Keras and Tensorflow
- Nginx
Running the setup_server.sh
script will
- download setup redis and rq
- setup nginx
- setup systemctl services
- install all the dependencies
Change the paths in start.sh
script to properly start rq and the flask server.
On successfully running start.sh
the following hapens,
Validator
class inbackend/validate.py
is the main link between the model and the server. Have a look at the comments to get an idea.- On a successful request, the
run_model
function call is queued usingrq
which usesredis
as a backend. - The job queue gets successfully executed
This is the schema of the data stored on firebase which is used by the dashboard component.
{
submissions:{
uid2: [{
gps_coordinates: array[string],
image_link: string,
status: string
}, ... ],
uid2: [],
uid3: [], ...
},
results: {
priority_high: [{
uid: string,
gps_coordinates: array[string],
image_link: string,
validity: float,
severity: float,
action_taken: boolean,
issue_fixed: boolean
}, ...],
priority_mid: [{ same as above }],
priority_low: [{ same as above }],
priority_verylow: [{ same as above }]
}
}
// User Submissions keep getting added in the not_processed part
// Once processed they move to the processed part and get added accordingly in
// the results part
Copyright (c) Team BitFlip. All rights reserved. Licensed under the MIT License