Skip to content

Commit

Permalink
Merge browser module into master. (#187)
Browse files Browse the repository at this point in the history
* Browser/fix/open empty annotations (#111)

* Browser/feature/disable page scroll (#116)

* Browser/feature/add canvas padding (#117)

* Update, refactor brush (#120)

* Update browser contrast adjustment (#121)

* Add outline capability to browser (#122)

* Initial timestamp tracking (#124)

* Initial url options, RGB mode (#130)

* Update initial brush params (#136)

* Initial changes to image modification code (#138)

* Fix npz upload issues (#139)

* Misc small changes to rgb (#141)

* Add travis and use Flask Blueprints to remove redundant application files. (#144)

* Add docker-compose.yml for easier local development (#146)

* Change environment variables to AWS standards. (#147)

* fix S3 env vars that got lost in the merge. (#148)

* Update npz canvas (expansion, better scaling, pan+zoom) (#149)

* Update HTML templates with the materialize CSS framework (#154)

* Add logger statements to most backend routes. (#157)

* Use distutils.util.strtobool to cast boolean request args to bools. (#163)

* Fix some browser rgb image generation edge cases (#164)

* Use PIL to create PNGs if not using a cmap. (#165)

* Don't need to return raw data on action requests. (#166)

* Save npzs with X and y (#168)

* Hide labels, bugfixes (#174)

* add flask-cors and enable CORS for all routes. (#178)

* Update browser with better logging and error handling. (#179)

* Add unit tests for Flask application. (#186)

Co-authored-by: geneva-miller <45578681+geneva-miller@users.noreply.github.com>
Co-authored-by: Thomas Dougherty <tdowlingdougherty@gmail.com>
  • Loading branch information
3 people committed Jul 22, 2020
1 parent cf91cb4 commit fc856c7
Show file tree
Hide file tree
Showing 53 changed files with 3,904 additions and 2,197 deletions.
29 changes: 29 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .coveragerc to control coverage.py
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
except ImportError

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

ignore_errors = True
# fail_under = 70
show_missing = True

omit =
**/*_test.py
env/**/*.py
venv/**/*.py
ENV/**/*.py
VENV/**/*.py
desktop/env/**/*.py
desktop/venv/**/*.py
desktop/ENV/**/*.py
desktop/VENV/**/*.py
browser/env/**/*.py
browser/venv/**/*.py
browser/ENV/**/*.py
browser/VENV/**/*.py
browser/conftest.py
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
dist: xenial

git:
depth: false

language: python

cache: pip

python:
- 3.6
- 3.7
- 3.8

install:
- pip install -r browser/requirements.txt
- pip install -r browser/requirements-test.txt

script:
- pytest browser --cov browser --pep8

after_success:
- coveralls
4 changes: 4 additions & 0 deletions browser/.ebextensions/healthcheckurl.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
option_settings:
- namespace: aws:elasticbeanstalk:application
option_name: Application Healthcheck URL
value: /health
3 changes: 1 addition & 2 deletions browser/.ebextensions/options.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
option_settings:
- namespace: aws:elasticbeanstalk:container:python
option_name: WSGIPath
value: eb_application.py

value: application.py
11 changes: 11 additions & 0 deletions browser/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Flask settings
DEBUG=
TEMPLATES_AUTO_RELOAD=

# AWS credentials
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

# SQL Alchemy settings
SQLALCHEMY_DATABASE_URI=
SQLALCHEMY_TRACK_MODIFICATIONS=
13 changes: 13 additions & 0 deletions browser/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.7

WORKDIR /usr/src/app

COPY requirements.txt requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 5000

CMD ["/bin/sh", "-c", "python application.py"]
32 changes: 31 additions & 1 deletion browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ pip install -r requirements.txt
```bash
python3 application.py
```
## To use docker-compose for local development
Add your AWS credentials to ```docker-compose.yaml```.

From the ```caliban/browser``` folder, run:
```bash
sudo docker-compose up --build -d
```
Wait a minute for the database to finish setting up before running:
```
sudo docker-compose restart app
```
You can now go to 0.0.0.0:5000 in a browser window to access the local version of the tool.

To interact with the local mysql database:
```
sudo docker exec -it browser_db_1 bash
mysql -p
```
When finished:
```
sudo docker-compose down
```
(optional)
```
sudo docker system prune --volumes
```

## Structure of Browser Version

Expand Down Expand Up @@ -81,7 +107,7 @@ Keybinds in pixel editing mode are different from those in the label-editing mod

Annotation mode focuses on using an adjustable brush to modify annotations on a pixel level, rather than using operations that apply to every instance of a label within a frame or set of frames. The brush tool will only make changes to the currently selected value. Ie, a brush set to edit cell 5 will only add or erase "5" to the annotated image.

*-/=* - increment value that brush is applying
*[ (left bracket) / ] (right bracket)* - increment value that brush is applying

*&darr; &uarr;* - change size of brush tool

Expand All @@ -100,6 +126,10 @@ Annotation mode focuses on using an adjustable brush to modify annotations on a

### Viewing Options:

*spacebar + click and drag* - pan across canvas

*-/= keys or alt + scroll wheel* - zoom in and out

*c* - cycle between different channels when no cells are selected

*e* - toggle annotation mode (when nothing else selected)
Expand Down
Loading

0 comments on commit fc856c7

Please sign in to comment.