Instructions to use aekupor/adding_on with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aekupor/adding_on with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="aekupor/adding_on")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("aekupor/adding_on") model = AutoModelForSequenceClassification.from_pretrained("aekupor/adding_on", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download handler.py from aekupor/adding_on: direct link, hf CLI and curl.
- Browser
- Download file 613 Bytes
-
https://huggingface.co/aekupor/adding_on/resolve/main/handler.py
- Command line
-
hf download hf://aekupor/adding_on/handler.py
-
curl -L -o handler.py https://huggingface.co/aekupor/adding_on/resolve/main/handler.py
613 Bytes
| from simpletransformers.classification import ClassificationModel, ClassificationArgs | |
| from typing import Dict, List, Any | |
| import pandas as pd | |
| import webvtt | |
| from datetime import datetime | |
| import torch | |
| import spacy | |
| class EndpointHandler(): | |
| def __init__(self, path="."): | |
| print("Loading models...") | |
| cuda_available = torch.cuda.is_available() | |
| self.model = ClassificationModel( | |
| "roberta", path, use_cuda=cuda_available | |
| ) | |
| def __call__(self, data_file: str) -> List[Dict[str, Any]]: | |
| ''' data_file is a str pointing to filename of type .vtt ''' | |
| return [] |