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 b70b481a61d292fbaa648ee64effc1c9cac56493
parent 87289c0fd6c79712ba6411bd39aaa63409551b49
Author: Henry Unite <unitehenry@gmail.com>
Date:   Fri, 13 Mar 2026 07:32:10 +0000

feat: run command

Diffstat:
Dapp.py | 30------------------------------
Ascripts/run | 2++
Asrc/app.py | 30++++++++++++++++++++++++++++++
3 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/app.py b/app.py @@ -1,30 +0,0 @@ -import modal - -app = modal.App("omniparser") - -image = ( - modal.Image.debian_slim(python_version="3.12") - .apt_install("git") - .apt_install("wget") - .shell(["/bin/bash", "-c"]) - .env({ 'CONDA_DIR': '/opt/conda' }) - .run_commands([ - "mkdir -p $CONDA_DIR", - "wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $CONDA_DIR/miniconda.sh", - "bash $CONDA_DIR/miniconda.sh -b -u -p $CONDA_DIR", - "rm $CONDA_DIR/miniconda.sh", - "$CONDA_DIR/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main", - "$CONDA_DIR/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r", - "$CONDA_DIR/bin/conda init --all" - ]) - .run_commands("git clone https://github.com/microsoft/OmniParser") - .run_commands("&&".join([ - "cd OmniParser", - "$CONDA_DIR/bin/conda create -n 'omni' python==3.12 -y", - "$CONDA_DIR/bin/conda run -n omni pip install -r requirements.txt" - ])) -) - -@app.function(gpu="h100", image=image) -def square(x): - print("This code is running on a remote worker!") diff --git a/scripts/run b/scripts/run @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +uv run modal run src/app.py --x ANY diff --git a/src/app.py b/src/app.py @@ -0,0 +1,30 @@ +import modal + +app = modal.App("omniparser") + +image = ( + modal.Image.debian_slim(python_version="3.12") + .apt_install("git") + .apt_install("wget") + .shell(["/bin/bash", "-c"]) + .env({ 'CONDA_DIR': '/opt/conda' }) + .run_commands([ + "mkdir -p $CONDA_DIR", + "wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $CONDA_DIR/miniconda.sh", + "bash $CONDA_DIR/miniconda.sh -b -u -p $CONDA_DIR", + "rm $CONDA_DIR/miniconda.sh", + "$CONDA_DIR/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main", + "$CONDA_DIR/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r", + "$CONDA_DIR/bin/conda init --all" + ]) + .run_commands("git clone https://github.com/microsoft/OmniParser") + .run_commands(" && ".join([ + "cd OmniParser", + "$CONDA_DIR/bin/conda create -n 'omni' python==3.12 -y", + "$CONDA_DIR/bin/conda run -n omni pip install -r requirements.txt" + ])) +) + +@app.function(gpu="h100", image=image) +def square(x): + print("This code is running on a remote worker!")