Text Classification
Transformers
Safetensors
Chinese
spam-detection
advertising-detection
chinese
modernbert
multi-task
four-head
Instructions to use x6nux/laya-ad with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use x6nux/laya-ad with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="x6nux/laya-ad")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("x6nux/laya-ad", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 578 Bytes
0cd599e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import time
from contextlib import ExitStack
import pytest
from fastapi.testclient import TestClient
@pytest.fixture
def client_factory():
with ExitStack() as stack:
yield lambda *args, **kwargs: stack.enter_context(TestClient(*args, **kwargs))
def wait_for_usage(client, requests):
deadline = time.monotonic() + 5
while True:
usage = client.get('/internal/usage').json()
if usage['totals']['requests'] == requests:
return usage
assert time.monotonic() < deadline, usage
time.sleep(0.01)
|