Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastapi #40

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Fastapi #40

wants to merge 12 commits into from

Conversation

riven314
Copy link
Owner

@riven314 riven314 commented Sep 27, 2020

Changes

  • set up fastAPI for model inference
  • dockerized and refactor streamlit (app) and fastAPI (api) codebase
  • set up docker compose to build 2 images together
  • update README for setting up docker build
  • resize image before sending POST request to API server if the image is too big

@riven314 riven314 linked an issue Sep 27, 2020 that may be closed by this pull request
api/Makefile Outdated Show resolved Hide resolved
api/config/model.yaml Outdated Show resolved Hide resolved
api/config/model.yaml Show resolved Hide resolved
@@ -0,0 +1,46 @@
import os
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire file can and should be shared across model, app and api.

Copy link
Owner Author

@riven314 riven314 Oct 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making 2 docker images to share a common parent utils folder is a bit hard to setup.
as an easier workaround, I simply created a common.py to contain common util function, and then duplicate common.py into app/src and api/src

@@ -0,0 +1,11 @@
REQUEST_URL = 'http://127.0.0.1'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adapt this to the configuration style we've adopted in model

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this config.py is only used in pytest for testing.
it will not be used in production


SUCCESS_CODE = 200

IMAGE_PATH = '../app/demo/demo_img1.jpg'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not belong in api's config.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same above
this config.py is only used in pytest for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

set up API
2 participants