modal-omniparser

A serverless compute port of the OmniParser vision model for the Modal platform.
git clone https://unitehenry.com/git/modal-omniparser.git
Log | Files | Refs | README

commit 7df68cfbc1c10ed88ac91e9788428498b5dc2dd3
parent b70b481a61d292fbaa648ee64effc1c9cac56493
Author: Henry Unite <unitehenry@gmail.com>
Date:   Fri, 13 Mar 2026 08:05:37 +0000

feat: omniparser image

Diffstat:
Mscripts/run | 2+-
Msrc/app.py | 18++++++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/scripts/run b/scripts/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -uv run modal run src/app.py --x ANY +uv run modal run src/app.py::model_to_cuda diff --git a/src/app.py b/src/app.py @@ -6,6 +6,7 @@ image = ( modal.Image.debian_slim(python_version="3.12") .apt_install("git") .apt_install("wget") + .apt_install("curl") .shell(["/bin/bash", "-c"]) .env({ 'CONDA_DIR': '/opt/conda' }) .run_commands([ @@ -18,13 +19,18 @@ image = ( "$CONDA_DIR/bin/conda init --all" ]) .run_commands("git clone https://github.com/microsoft/OmniParser") - .run_commands(" && ".join([ - "cd OmniParser", + .workdir("OmniParser") + .run_commands([ "$CONDA_DIR/bin/conda create -n 'omni' python==3.12 -y", - "$CONDA_DIR/bin/conda run -n omni pip install -r requirements.txt" - ])) + "$CONDA_DIR/bin/conda run -n omni pip install -r requirements.txt", + ]) + .run_commands("curl -LsSf https://hf.co/cli/install.sh | bash") + .run_commands([ + 'for f in icon_detect/{train_args.yaml,model.pt,model.yaml} icon_caption/{config.json,generation_config.json,model.safetensors}; do env PATH="/root/.local/bin:$PATH" hf download microsoft/OmniParser-v2.0 "$f" --local-dir weights; done', + "mv weights/icon_caption weights/icon_caption_florence" + ]) ) @app.function(gpu="h100", image=image) -def square(x): - print("This code is running on a remote worker!") +def model_to_cuda(): + print('model_to_cuda')