Code for the Green Data project, containing:
- Computer Vision wrapper
- Website
- I/O
- DB
Tutorial for this web's setup: https://towardsdatascience.com/build-deploy-a-react-flask-app-47a89a5d17d9
It is preferable to create a new virtual environment to avoid dependency errors. To do this create a new environment called "venv" on the top directory with the packages in "requirements.txt", in linux:
- cd greendata
- python3 -m venv venv
- source venv/bin/activate
- pip install -r requirements.txt
- cd greendata
- source venv/bin/activate
- cd api
- python
From here you can run whatever module you need, to run main for example:
>> from calculadora.calculadora import main
>> main()
To train a new model do:
- cd greendata
- python -m api.model.modelo
You will need to run two terminals, one for backend and one for frontend.
To run backend on linux:
- cd greendata
- source venv/bin/activate
- flask run
To check it works open https://localhost:5000/flask/hello on a browser.
To run frontend:
- cd greendata/frontend
- npm start
A window with the webpage on localhost:3000 should open after a while.
It's possible the code has been set up for a heroku deploy. If this is the case you will need to uncomment the CORS lines in app.py as specified in the comments there, and change the web api calls from https://greendata.herokuapp.com to https://localhost:5000.