zenoda/trocr-captcha-killer
Viewer • Updated • 1 • 5
How to use zenoda/trocr-captcha-killer with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="zenoda/trocr-captcha-killer") # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("zenoda/trocr-captcha-killer")
model = AutoModelForMultimodalLM.from_pretrained("zenoda/trocr-captcha-killer")How to use zenoda/trocr-captcha-killer with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "zenoda/trocr-captcha-killer"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "zenoda/trocr-captcha-killer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/zenoda/trocr-captcha-killer
How to use zenoda/trocr-captcha-killer with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "zenoda/trocr-captcha-killer" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "zenoda/trocr-captcha-killer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "zenoda/trocr-captcha-killer" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "zenoda/trocr-captcha-killer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use zenoda/trocr-captcha-killer with Docker Model Runner:
docker model run hf.co/zenoda/trocr-captcha-killer
accuracy: 0.937338
from transformers import VisionEncoderDecoderModel, TrOCRProcessor
from PIL import Image
import requests
processor = TrOCRProcessor.from_pretrained("zenoda/trocr-captcha-killer")
model = VisionEncoderDecoderModel.from_pretrained("zenoda/trocr-captcha-killer")
model.to('cuda')
url = 'https://huggingface.co/datasets/zenoda/trocr-captcha-killer/resolve/main/106-1688354008849.png'
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
generated_ids = model.generate(processor(image, return_tensors="pt").pixel_values.to('cuda'))
predictText = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(predictText)