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

[DEVX:119] Model Interface #141

Closed
wants to merge 331 commits into from
Closed

Conversation

sainivedh
Copy link
Contributor

What

  • Added functionality to interface with Models(predict, list, versions)

How

Model Predict

from clarifai.client.model import Model

# Model Predict
model = Model(user_id="user_id", app_id="app_id", model_id="model_id")
model_prediction = model.predict_by_url(url="url", input_type="image") # Supports image, text, audio, video

# Customizing Model Inference Output
model = Model(user_id="user_id", app_id="app_id", model_id="model_id",
                  output_config={"min_value": 0.98}) # Return predictions having prediction confidence > 0.98
model_prediction = model.predict_by_filepath(filepath="local_filepath", input_type="text") # Supports image, text, audio, video

model = Model(user_id="user_id", app_id="app_id", model_id="model_id",
                    output_config={"sample_ms": 2000}) # Return predictions for specified interval
model_prediction = model.predict_by_url(url=BEER_VIDEO_URL, input_type="video")

Models Listing

# List all model versions
all_model_versions = model.list_versions()

# Go to specific model version
model_v1 = client.app("app_id").model("model_id").version("model_version_id")

# List all models in an app
all_models = app.list_models()

# List all models in community filtered by model_type, description
all_llm_community_models = App().list_models(filter_by={"query": "LLM",
                                                        "model_type_id": "text-to-text"}, only_in_app=False)

Tests

Unit tests added for Model predict with different scenarios

  • Predict by filepath, url, bytes
  • Predict by various output configs (max_concepts, min_value, selected_concepts)

zeiler and others added 30 commits November 11, 2014 00:08
deleted img.close() - close() isn't supported on PIL.Image
"/".join() instead of os.path.join() for urls
Use setuptools so the client can be pip-installed.
rok-clarifai and others added 25 commits July 24, 2020 18:20
Let's use the latest & greatest available face-deteciton models.
remove test for people-segmentation model
The model is internal only and old.
* added authentication setup
* added listing interface
README.md Outdated Show resolved Hide resolved
@sainivedh sainivedh marked this pull request as draft August 16, 2023 12:26
@sainivedh sainivedh changed the base branch from clarifai-sdk-dev to candidate-master August 17, 2023 12:41
@sainivedh sainivedh closed this Aug 17, 2023
@sainivedh sainivedh deleted the DEVX-119-Model-Interface branch August 17, 2023 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.