Skip to content

Commit

Permalink
fixed annotated image download from docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sumn2u committed Jun 19, 2024
1 parent bcd7692 commit 572da5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ docker-compose up -d #running in detached mode
```
The application should be running on [http://localhost](http://localhost).

**Note:** The downloading functionality is currently **not supported** when running the application within a Docker container.

## Running Tests

### Client Tests
Expand Down
10 changes: 10 additions & 0 deletions server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ def download_image_with_annotations():

for image_info in images:
image_url = image_info.get("regions", [])[0].get("image-src")

# Docker container uses port 5000, so replace 5001 with 5000
if "127.0.0.1:5001" in image_url:
image_url = image_url.replace("127.0.0.1:5001", "127.0.0.1:5000")

response = requests.get(image_url)
image = Image.open(BytesIO(response.content))
draw = ImageDraw.Draw(image)
Expand Down Expand Up @@ -365,6 +370,11 @@ def download_image_mask():

for image_info in images:
image_url = image_info.get("regions", [])[0].get("image-src")

# Docker container uses port 5000, so replace 5001 with 5000
if "127.0.0.1:5001" in image_url:
image_url = image_url.replace("127.0.0.1:5001", "127.0.0.1:5000")

response = requests.get(image_url)
image = Image.open(BytesIO(response.content))
width, height = image.size
Expand Down

0 comments on commit 572da5f

Please sign in to comment.