FlameOCR
Collection
llm ocr • 2 items • Updated • 1
How to use anyforge/Flame-OCR-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="anyforge/Flame-OCR-gguf", filename="flame-ocr.BF16-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"
}
}
]
}
]
)How to use anyforge/Flame-OCR-gguf with llama.cpp:
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf anyforge/Flame-OCR-gguf:BF16 # Run inference directly in the terminal: llama cli -hf anyforge/Flame-OCR-gguf:BF16
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf anyforge/Flame-OCR-gguf:BF16 # Run inference directly in the terminal: llama cli -hf anyforge/Flame-OCR-gguf:BF16
# 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 anyforge/Flame-OCR-gguf:BF16 # Run inference directly in the terminal: ./llama-cli -hf anyforge/Flame-OCR-gguf:BF16
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 anyforge/Flame-OCR-gguf:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf anyforge/Flame-OCR-gguf:BF16
docker model run hf.co/anyforge/Flame-OCR-gguf:BF16
How to use anyforge/Flame-OCR-gguf with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "anyforge/Flame-OCR-gguf"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "anyforge/Flame-OCR-gguf",
"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"
}
}
]
}
]
}'docker model run hf.co/anyforge/Flame-OCR-gguf:BF16
How to use anyforge/Flame-OCR-gguf with Ollama:
ollama run hf.co/anyforge/Flame-OCR-gguf:BF16
How to use anyforge/Flame-OCR-gguf with Unsloth Studio:
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 anyforge/Flame-OCR-gguf to start chatting
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 anyforge/Flame-OCR-gguf to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for anyforge/Flame-OCR-gguf to start chatting
How to use anyforge/Flame-OCR-gguf with Pi:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf anyforge/Flame-OCR-gguf:BF16
# Install Pi:
npm install -g @mariozechner/pi-coding-agent
# Add to ~/.pi/agent/models.json:
{
"providers": {
"llama-cpp": {
"baseUrl": "http://localhost:8080/v1",
"api": "openai-completions",
"apiKey": "none",
"models": [
{
"id": "anyforge/Flame-OCR-gguf:BF16"
}
]
}
}
}# Start Pi in your project directory: pi
How to use anyforge/Flame-OCR-gguf with Hermes Agent:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf anyforge/Flame-OCR-gguf:BF16
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default anyforge/Flame-OCR-gguf:BF16
hermes
How to use anyforge/Flame-OCR-gguf with OpenClaw:
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf anyforge/Flame-OCR-gguf:BF16
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "anyforge/Flame-OCR-gguf:BF16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
openclaw agent --local --agent main --message "Hello from Hugging Face"
How to use anyforge/Flame-OCR-gguf with Docker Model Runner:
docker model run hf.co/anyforge/Flame-OCR-gguf:BF16
How to use anyforge/Flame-OCR-gguf with Lemonade:
# Download Lemonade from https://lemonade-server.ai/ lemonade pull anyforge/Flame-OCR-gguf:BF16
lemonade run user.Flame-OCR-gguf-BF16
lemonade list
👉 Flame-OCR Github
convert by unsloth
llama.cpp server
llama-server \
-m ./flame-ocr/flame-ocr.BF16.gguf \
--mmproj ./flame-ocr/flame-ocr.BF16-mmproj.gguf \
--port 18003 \
--host 0.0.0.0 \
--temp 0 \
--alias "flame-ocr" \
--api-key "sk-123456"
ollama run AnyForge/flame-ocr:latest
import base64
from openai import OpenAI
def image_to_base64(image_path: str) -> str:
with open(image_path, "rb") as f:
return base64.b64encode(f.read()).decode("utf-8")
client = OpenAI(
base_url="http://localhost:18003/v1",
api_key="sk-123456"
)
image_path = "/path/to/image.png"
base64_image = image_to_base64(image_path)
prompt = '\nExtract all readable content from the image in natural human reading order and output the result as a single Markdown document. For charts or images, represent them using an HTML image tag: <' + 'img src="images/bbox_{left}_{top}_{right}_{bottom}.jpg" />, where left, top, right, bottom are bounding box coordinates scaled to [0, 1000). Format formulas as LaTeX. Format tables as HTML: <table>...</table>. Transcribe all other text as standard Markdown. Preserve the original text without translation or paraphrasing.'
response = client.chat.completions.create(
model="flame-ocr",
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": f"data:image/png;base64,{base64_image}"
}
},
{
"type": "text",
"text": prompt
}
]
}
],
max_tokens=8192,
temperature=0.0,
extra_body={
"mm_processor_kwargs": {
"images_kwargs": {
"min_pixels": 448 * 448,
"max_pixels": 2880 * 2880
}
}
}
)
print(response.choices[0].message.content)
16-bit