# Ranking Model

> 🚧 Note
>
> For more information on uploading a model artifact to Fiddler, see [Uploading a Model Artifact](/developers/client-library-reference/explainability/uploading-model-artifacts.md).

Suppose you would like to upload a model artifact for a **ranking model**.

Following is an example of what the `package.py` script may look like.

```python
import pickle
from pathlib import Path
import pandas as pd

PACKAGE_PATH = Path(__file__).parent

class ModelPackage:

    def __init__(self):
        self.output_columns = ['score']
        with open(f'{PACKAGE_PATH}/model.pkl', 'rb') as infile:
            self.model = pickle.load(infile)
    
    def predict(self, input_df):
        pred = self.model.predict(input_df)
        return pd.DataFrame(pred, columns=self.output_columns)
    
def get_model():
    return ModelPackage()
```

Here, we are assuming that the model prediction column that has been specified in the [`fdl.ModelSpec`](/api/fiddler-python-client-sdk/schemas/model-spec.md) object is called `score`.

Please checkout this [quickstart notebook](/developers/tutorials/ml-monitoring/ranking-model.md) to work through an example of onboarding a ranking model on to Fiddler.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fiddler.ai/developers/client-library-reference/explainability/model-task-examples/uploading-a-ranking-model-artifact.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
