zero-shot-tagger-default

Classify text without without any need to train in advance. Just provide a set of output labels in plain English and start using.

Using

Tagger Plugins add annotations to text that can be queried and composed later.

Blockifiers convert data into Steamship’s native Block format.

Importer Plugins add annotations to text that can be queried and composed later.

Use them when writing Packages to help you work with data of different types.

Links

from steamship import Steamship, File

client = Steamship(workspace="my-workspace-handle")

# Import a file to Steamship
with open("file.ext") as f:
  file = File.create(content=file.read())

# Create an instance of this blockifier
blockifier = client.use_plugin(
  'zero-shot-tagger-default'
)

# Blockify the file
task = file.blockify()
task.wait()
from steamship import Steamship, File

client = Steamship(workspace="my-workspace-handle")

# Import a file to Steamship
with open("file.ext") as f:
  file = File.create(content=file.read())

# Create a blockifier. We'll assume Markdown here.
blockifier = client.use_plugin(
  'markdown-blockifier-default'
)

# Blockify the file
task = file.blockify()

# Create an instance of this tagger.
tagger = client.use_plugin(
  'zero-shot-tagger-default'
)

# Tag the file
task = file.tag()

task.wait()
Pulled from the GitHub repository.
# Zero-Shot Classifier Plugin 

### https://huggingface.co/facebook/bart-large-mnli

This plugin wraps a (zero-shot classification model)[https://huggingface.co/models?pipeline_tag=zero-shot-classification] available on hugging face.

When you instantiate this plugin, you must provide it `labels` that will be used to label the data, and a `tag_kind` that will be used to identify the resulting tags.

Set `multi_label=True` if classes can overlap.

For example, if you wished to classify sentences about cats versus those about dogs, you could use:

```
labels='cats,dogs'
tag_kind='my-animal-classification'
```
and this would result in tags of the form:
```python
Tag(kind='my-animal-classification',name='dog',value={'score': 0.9})
```

The plugin will classify the text in every `Block` of the `File` that it receives as input. 

To use this plugin, you must also provide a `hf_api_bearer_token` which will be used to invoke the model.

## Parameters

| Parameter | Description | DType | Required | Default |
|-------------------|----------------------------------------------------|--------|--|--|
| hf_api_bearer_token | Your bearer token from the Hugging Face API. | string |Yes| d |
| hf_model_path | Your bearer token from the Hugging Face API. | string |Yes| - |
| labels | A comma-separated list of labels that will be applied. | string |Yes|  - |
| tag_kind | A value for 'kind' in the Tag objects that will be returned. | string |Yes|  - |
| multi_label | Whether classification labels can overlap. | string |Yes| False |
| use_gpu | Process HF requests on GPU (at greater speed and cost). | string |No| False |

## Developing

Development instructions are located in [DEVELOPING.md](https://github.com/steamship-plugins/tagger-zero-shot-class-hf-bart-mnli/blob/main/DEVELOPING.md)

## Testing

Testing instructions are located in [TESTING.md](https://github.com/steamship-plugins/tagger-zero-shot-class-hf-bart-mnli/blob/main/TESTING.md)

## Deploying

Deployment instructions are located in [DEPLOYING.md](https://github.com/steamship-plugins/tagger-zero-shot-class-hf-bart-mnli/blob/main/DEPLOYING.md)

Steamship is building the fastest way to ship language AI.

Stop building and start shipping. Reach out to get onboarded.
Read More