Skip to content

Commit

Permalink
adding very basic support for invoking pretrained classifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
beijbom committed Sep 18, 2024
1 parent 33a2cb8 commit d452c9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/nyckel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@
from .functions.tags.text_tags import TextTagsFunction # noqa: F401
from .functions.tags.image_tags import ImageTagsFunction # noqa: F401
from .functions.tags.tabular_tags import TabularTagsFunction # noqa: F401

from .functions.pretrained import invoke as call
from .functions.pretrained import invoke # noqa: F401
9 changes: 9 additions & 0 deletions src/nyckel/functions/pretrained.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from typing import Dict

from nyckel import Credentials


def invoke(model_id: str, data: str, client_id: str, client_secret: str) -> Dict:
session = Credentials(client_id, client_secret).get_session()
endpoint = f"https://www.nyckel.com/v1/functions/{model_id}/invoke"
return session.post(endpoint, json={"data": data}).json()

0 comments on commit d452c9f

Please sign in to comment.