Skip to content

Commit

Permalink
Update dependencies and Fix worker places detection (#67)
Browse files Browse the repository at this point in the history
* Dependencies and version updates

* Fix openstreetmap API call with user-agent specific to smriti-worker

* Fixed linter error
  • Loading branch information
prabhuomkar authored May 8, 2024
1 parent 25b67f6 commit 80e42c2
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ type (
Faces bool `envconfig:"SMRITI_ML_FACES" default:"true"`
PlacesProvider string `envconfig:"SMRITI_ML_PLACES_PROVIDER" default:"openstreetmap"`
ClassificationProvider string `envconfig:"SMRITI_ML_CLASSIFICATION_PROVIDER" default:"pytorch"`
ClassificationParams string `envconfig:"SMRITI_ML_CLASSIFICATION_PARAMS" default:"{\"file\":\"classification_v240531.pt\"}"`
ClassificationParams string `envconfig:"SMRITI_ML_CLASSIFICATION_PARAMS" default:"{\"file\":\"classification_v240508.pt\"}"`
OCRProvider string `envconfig:"SMRITI_ML_OCR_PROVIDER" default:"paddlepaddle"`
OCRParams string `envconfig:"SMRITI_ML_OCR_PARAMS" default:"{\"det_model_dir\":\"det_onnx\",\"rec_model_dir\":\"rec_onnx\",\"cls_model_dir\":\"cls_onnx\"}"`
SearchProvider string `envconfig:"SMRITI_ML_SEARCH_PROVIDER" default:"pytorch"`
SearchParams string `envconfig:"SMRITI_ML_SEARCH_PARAMS" default:"{\"tokenizer_dir\":\"search_tokenizer\",\"processor_dir\":\"search_processor\",\"text_file\":\"search_text_v240531.pt\",\"vision_file\":\"search_vision_v240531.pt\"}"` //nolint:lll
SearchParams string `envconfig:"SMRITI_ML_SEARCH_PARAMS" default:"{\"tokenizer_dir\":\"search_tokenizer\",\"processor_dir\":\"search_processor\",\"text_file\":\"search_text_v240508.pt\",\"vision_file\":\"search_vision_v240508.pt\"}"` //nolint:lll
FacesProvider string `envconfig:"SMRITI_ML_FACES_PROVIDER" default:"pytorch"`
FacesParams string `envconfig:"SMRITI_ML_FACES_PARAMS" default:"{\"minutes\":\"1\",\"face_threshold\":\"0.9\",\"model\":\"vggface2\",\"clustering\":\"annoy\"}"`
MetadataParams string `envconfig:"SMRITI_ML_METADATA_PARAMS" default:"{\"thumbnail_size\":\"512\"}"`
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/user-guide/features/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Enable this feature using API Configuration:
```bash
SMRITI_ML_SEARCH: true
SMRITI_ML_SEARCH_PROVIDER: pytorch
SMRITI_ML_SEARCH_PARAMS: {"tokenizer_dir":"search_tokenizer","processor_dir":"search_processor","text_file":"search_text_v240531.pt","vision_file":"search_vision_v240531.pt"}
SMRITI_ML_SEARCH_PARAMS: {"tokenizer_dir":"search_tokenizer","processor_dir":"search_processor","text_file":"search_text_v240508.pt","vision_file":"search_vision_v240508.pt"}
```

## Use Cases
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/user-guide/features/things.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Enable this feature using API Configuration:
SMRITI_FEATURE_THINGS: true
SMRITI_ML_CLASSIFICATION: true
SMRITI_ML_CLASSIFICATION_PROVIDER: pytorch
SMRITI_ML_CLASSIFICATION_PARAMS: {"file":"classification_v240531.pt"}
SMRITI_ML_CLASSIFICATION_PARAMS: {"file":"classification_v240508.pt"}
```

## Use Cases
Expand Down
4 changes: 2 additions & 2 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smriti",
"version": "24.05.31",
"version": "24.05.08",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
Expand Down
4 changes: 2 additions & 2 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Smriti API
description: Smarter Home for all your Photos and Videos
version: 24.05.31
version: 24.05.08
servers:
- url: https://localhost:5001
tags:
Expand Down Expand Up @@ -1329,7 +1329,7 @@ components:
properties:
version:
type: string
example: 24.05.31
example: 24.05.08
gitSha:
type: string
example: addf120b430021c36c232c99ef8d926aea2acd6b
Expand Down
8 changes: 4 additions & 4 deletions worker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
annoy==1.17.3
asyncio==3.4.3
facenet-pytorch==2.5.3
grpcio==1.62.2
grpcio-tools==1.62.2
minio==7.2.6
grpcio==1.63.0
grpcio-tools==1.63.0
minio==7.2.7
moviepy==1.0.3
opencv-python==4.9.0.80
prometheus-client==0.20.0
Pillow==10.3.0
PyExifTool==0.5.6
rapidocr-onnxruntime==1.2.3
rawpy==0.19.1
rawpy==0.21.0
requests==2.31.0
schedule==1.2.1
torch==2.3.0
Expand Down
3 changes: 2 additions & 1 deletion worker/src/providers/places/openstreetmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def __init__(self) -> None:
def reverse_geocode(self, mediaitem_user_id: str, mediaitem_id: str, coordinates: list[float]) -> dict:
"""Reverse geocode location from co-ordinates"""
url = self.url.format(lat=coordinates[0], lon=coordinates[1])
res = requests.get(url=url, headers={'accept-language':'en-GB,en-US'}, timeout=self.timeout)
res = requests.get(url=url, headers={'accept-language':'en-GB,en-US','user-agent':'smriti-worker'},
timeout=self.timeout)
res.raise_for_status()

body = res.json()
Expand Down

0 comments on commit 80e42c2

Please sign in to comment.