Skip to content

Commit

Permalink
Improve the local development experience (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludelafo authored Jan 31, 2024
1 parent 1a4a356 commit 7675d73
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
6 changes: 6 additions & 0 deletions development.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Base image
FROM python:3.10

# Install all required packages to run the model
# TODO: 1. Add any additional packages required to run your model
# RUN apt update && apt install --yes package1 package2 ...
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
services:
service:
container_name: service
build:
context: .
dockerfile: development.Dockerfile
command: |
bash -c "
# Create the virtual environment
python3.10 -m venv .venv &&
# Activate the virtual environment
source .venv/bin/activate &&
# Install the dependencies
pip install -r requirements.txt -r requirements-all.txt &&
# Run the service
cd src &&
uvicorn --reload --host 0.0.0.0 --port 9090 main:app
"
environment:
- ENGINE_URLS=["http://host.docker.internal:8080"]
- SERVICE_URL=http://host.docker.internal:9090
ports:
- 9090:9090
working_dir: /workspaces/service
volumes:
- .:/workspaces/service
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def __init__(self):
# TODO: 5. CHANGE THE PROCESS METHOD (CORE OF THE SERVICE)
def process(self, data):
# NOTE that the data is a dictionary with the keys being the field names set in the data_in_fields
raw = data["image"].data
input_type = data["image"].type
# raw = data["image"].data
# input_type = data["image"].type
# ... do something with the raw data

# NOTE that the result must be a dictionary with the keys being the field names set in the data_out_fields
Expand Down

0 comments on commit 7675d73

Please sign in to comment.