Instructions to use microsoft/OmniParser with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/OmniParser with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="microsoft/OmniParser")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("microsoft/OmniParser") model = AutoModelForMultimodalLM.from_pretrained("microsoft/OmniParser") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/OmniParser with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/OmniParser" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/OmniParser", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/OmniParser
- SGLang
How to use microsoft/OmniParser with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "microsoft/OmniParser" \ --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": "microsoft/OmniParser", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
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 "microsoft/OmniParser" \ --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": "microsoft/OmniParser", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/OmniParser with Docker Model Runner:
docker model run hf.co/microsoft/OmniParser
Failing to create a Space for OmniParser
---- CLOSED: YES IT WAS EASYOCR, THE MODEL FILES HAD TO BE INCLUDED IN THE REPO, WHICH SOLVED THE ISSUE ---
I am trying to create a Huggingface Space for OmniParser.
Currently it is failing with "Exit code: 1".
The last log message of the Container Log is:
"Downloading detection model, please wait. This may take several minutes depending upon your network connection."
Sounds like any of the used models doesn't find its model files and tries to download them and then fails.
Do you have any idea what I am missing?
ChatGPT thinks it might be easyocr.
This is my file list of the Space repo:
.gitattributes
.gitignore
app.py
demo.ipynb
Dockerfile
imgs
LICENSE
omniparser.py
README.md
requirements.txt
SECURITY.md
util
utils.py
weights
imgs\google_page.png
imgs\logo.png
imgs\saved_image_demo.png
imgs\windows_home.png
imgs\windows_multitab.png
util\action_matching.py
util\action_type.py
util\box_annotator.py
util_init_.py
weights\convert_safetensor_to_pt.py
weights\icon_caption_blip2
weights\icon_caption_florence
weights\icon_detect
weights\icon_caption_blip2\config.json
weights\icon_caption_blip2\generation_config.json
weights\icon_caption_blip2\LICENSE
weights\icon_caption_blip2\pytorch_model-00001-of-00002.bin
weights\icon_caption_blip2\pytorch_model-00001-of-00002.safetensors
weights\icon_caption_blip2\pytorch_model-00002-of-00002.bin
weights\icon_caption_blip2\pytorch_model-00002-of-00002.safetensors
weights\icon_caption_blip2\pytorch_model.bin.index.json
weights\icon_caption_florence\config.json
weights\icon_caption_florence\generation_config.json
weights\icon_caption_florence\LICENSE
weights\icon_caption_florence\model.safetensors
weights\icon_detect\best.pt
weights\icon_detect\LICENSE
weights\icon_detect\model.safetensors
weights\icon_detect\model.yaml