Image-Text-to-Text
Safetensors
GGUF
idefics3
vision-language
card-extraction
mobile-optimized
lora
continual-learning
structured-data
conversational
Eval Results (legacy)
Instructions to use sugiv/cardvaultplus with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use sugiv/cardvaultplus with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="sugiv/cardvaultplus", filename="gguf/cardvault-mmproj.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use sugiv/cardvaultplus with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sugiv/cardvaultplus:F16 # Run inference directly in the terminal: llama-cli -hf sugiv/cardvaultplus:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sugiv/cardvaultplus:F16 # Run inference directly in the terminal: llama-cli -hf sugiv/cardvaultplus:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf sugiv/cardvaultplus:F16 # Run inference directly in the terminal: ./llama-cli -hf sugiv/cardvaultplus:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf sugiv/cardvaultplus:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf sugiv/cardvaultplus:F16
Use Docker
docker model run hf.co/sugiv/cardvaultplus:F16
- LM Studio
- Jan
- vLLM
How to use sugiv/cardvaultplus with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sugiv/cardvaultplus" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sugiv/cardvaultplus", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/sugiv/cardvaultplus:F16
- Ollama
How to use sugiv/cardvaultplus with Ollama:
ollama run hf.co/sugiv/cardvaultplus:F16
- Unsloth Studio new
How to use sugiv/cardvaultplus with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sugiv/cardvaultplus to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sugiv/cardvaultplus to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for sugiv/cardvaultplus to start chatting
- Docker Model Runner
How to use sugiv/cardvaultplus with Docker Model Runner:
docker model run hf.co/sugiv/cardvaultplus:F16
- Lemonade
How to use sugiv/cardvaultplus with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull sugiv/cardvaultplus:F16
Run and chat with the model
lemonade run user.cardvaultplus-F16
List all available models
lemonade list
File size: 3,194 Bytes
24dc13b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | #!/usr/bin/env python3
"""
CardVault+ Inference Example
Simple example showing how to use the CardVault+ model for card extraction
"""
import torch
from transformers import AutoProcessor, AutoModelForVision2Seq
from PIL import Image, ImageDraw
import json
def create_sample_card():
"""Create a sample credit card image for testing"""
# Create card-like image
img = Image.new('RGB', (400, 250), color='lightblue')
draw = ImageDraw.Draw(img)
# Add card elements
draw.text((20, 50), "SAMPLE BANK", fill='black')
draw.text((20, 100), "1234 5678 9012 3456", fill='black')
draw.text((20, 150), "JOHN DOE", fill='black')
draw.text((300, 150), "12/25", fill='black')
return img
def extract_card_info(image_path_or_pil=None):
"""Extract structured information from a card image"""
# Load the model
print("Loading CardVault+ model...")
model_id = "sugiv/cardvaultplus"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForVision2Seq.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
# Load image
if image_path_or_pil is None:
print("Creating sample card image...")
image = create_sample_card()
elif isinstance(image_path_or_pil, str):
image = Image.open(image_path_or_pil)
else:
image = image_path_or_pil
# Prepare extraction prompt
prompt = "<image>Extract structured information from this card/document in JSON format."
# Process the image and prompt
inputs = processor(text=prompt, images=image, return_tensors="pt")
# Move to GPU if available
device = next(model.parameters()).device
inputs = {k: v.to(device) if hasattr(v, 'to') else v for k, v in inputs.items()}
# Generate extraction
print("Extracting information...")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=150,
do_sample=False,
pad_token_id=processor.tokenizer.eos_token_id
)
# Decode response
response = processor.decode(outputs[0], skip_special_tokens=True)
# Extract JSON if present
extracted_json = None
if '{' in response and '}' in response:
try:
json_start = response.find('{')
json_end = response.rfind('}') + 1
json_str = response[json_start:json_end]
extracted_json = json.loads(json_str)
except:
pass
return {
'full_response': response,
'extracted_json': extracted_json,
'success': extracted_json is not None
}
if __name__ == "__main__":
# Example usage
result = extract_card_info() # Uses sample card
print("="*50)
print("CardVault+ Extraction Results")
print("="*50)
print(f"Success: {result['success']}")
print(f"Full Response: {result['full_response']}")
if result['extracted_json']:
print("Extracted JSON:")
print(json.dumps(result['extracted_json'], indent=2))
# Example with your own image:
# result = extract_card_info("path/to/your/card.jpg")
|