微信扫码
添加专属顾问
我要投稿
微软开源AI神器OmniParser,让AI成为你的电脑操作专家,GitHub星标超16.3K! 核心内容: 1. OmniParser核心能力:将UI屏幕截图转换为结构化格式,精准理解和操作界面元素 2. V2版本性能提升:A100上0.6秒/帧,RTX 4090上0.8秒,平均准确率达39.6% 3. 环境搭建与实际应用:从克隆项目到创建Python环境,再到安装核心依赖和下载模型
微软官方发布并开源了OmniParser V2
OmniParser可以将任何大语言模型(LLM)变成能够使用计算机的AI助手!项目已在GitHub上收获超过16.3k星标。
今天就带大家完整体验下这个神器,从环境搭建到实际应用。
下面的视频演示了如何使用OmniParser AI Agent自动化的发布X 帖子:
OmniParser就像是给AI装上了一双"慧眼"。它能将UI屏幕截图转换为结构化的格式,让AI精准理解和操作界面上的每个元素。
V2版本性能更强:在A100上处理速度达到0.6秒/帧,在RTX 4090上也只需0.8秒。
在ScreenSpot Pro基准测试中更是达到了39.6%的平均准确率。
支持主流大模型,包括OpenAI (GPT-4V)、DeepSeek (R1)、Claude 3.5 Sonnet、Qwen (2.5VL)和Anthropic Computer Use。
通过全新的OmniTool,甚至可以直接控制Windows 11虚拟机!
首先克隆项目到本地:
git clone https://github.com/microsoft/OmniParser.gitcd OmniParser
创建并激活Python环境:
conda create -n "omni" python==3.12 conda activate omni
安装核心依赖:
pip install --upgrade huggingface_hub pip install gradio==4.14.0 pip install httpx==0.26.0 pip install httpcore==1.0.2 pip install anyio==4.2.0 pip install -r requirements.txt
创建一个download_models.py脚本:
import osfrom huggingface_hub import hf_hub_downloadfrom pathlib import Pathdef download_omniparser_models():"""下载OmniParser V2的模型文件"""try:
base_path = Path("weights")
base_path.mkdir(exist_ok=True)
files = ["icon_detect/train_args.yaml","icon_detect/model.pt","icon_detect/model.yaml","icon_caption/config.json","icon_caption/generation_config.json","icon_caption/model.safetensors"]print("开始下载模型文件...")for file in files:print(f"正在下载: {file}")
hf_hub_download(
repo_id="microsoft/OmniParser-v2.0",
filename=file,
local_dir=base_path
)
icon_caption_path = base_path / "icon_caption"icon_caption_florence_path = base_path / "icon_caption_florence"if icon_caption_path.exists():if icon_caption_florence_path.exists():import shutil
shutil.rmtree(icon_caption_florence_path)
icon_caption_path.rename(icon_caption_florence_path)print("\n所有文件下载完成!")except Exception as e:print(f"\n下载过程中出现错误: {str(e)}")print("请检查网络连接并重试")if __name__ == "__main__":
download_omniparser_models()在本地运行 Demo
python gradio_demo.py
运行后,打开浏览器访问本地服务(通常是 http://127.0.0.1:7860)。
上传任意界面截图后等待短暂处理(一般不超过1秒),就能看到详细的解析结果,包括可交互区域标注和功能描述。
效果如同下面这样,输入一张图片:
输出图标标记的结果:
结构化的 JSON,这里包含了元素的内容识别和具体的坐标值:
有了这些具体的结构化识别结果后,那么想象空间就可以无限大了!
这里我们将实现一个跨平台的自动化操作方案:在服务器上部署OmniParser服务,然后通过macOS客户端实现自动化操作。
服务端部署:
from fastapi import FastAPI, UploadFilefrom PIL import Imageimport ioimport uvicorn
app = FastAPI()@app.post("/analyze")async def analyze_screen(image: UploadFile):# 读取上传的图片image_data = await image.read()
image = Image.open(io.BytesIO(image_data))# 使用OmniParser处理图片# 这里添加OmniParser的处理逻辑return {"elements": [...]}# 返回识别到的元素信息if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)客户端实现(macOS):
import pyautoguiimport requestsfrom PIL import ImageGrabdef capture_screen():"""获取屏幕截图"""screenshot = ImageGrab.grab()return screenshotdef convert_coordinates(omni_coords):"""转换OmniParser坐标到PyAutoGUI坐标"""# 根据实际情况调整坐标转换逻辑return omni_coordsdef click_element(coords):"""执行点击操作"""pyautogui.click(coords[0], coords[1])def main():# 获取屏幕截图screenshot = capture_screen()# 发送到OmniParser服务files = {'image': ('screenshot.png', screenshot)}
response = requests.post('http://ubuntu-server:8000/analyze', files=files)# 处理返回结果elements = response.json()['elements']# 执行自动化操作for element in elements:
coords = convert_coordinates(element['coords'])
click_element(coords)if __name__ == "__main__":
main()说明如下:
在这个基础框架,我们可以进一步扩展:
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2025-12-23
智谱GLM-4.7:更强的代码,更好的美学
2025-12-22
Notesnook:一款完全开源、以隐私为核心的笔记应用
2025-12-22
一文彻底看懂 Google 最新开源 A2UI 协议:如何让 AI Agent “说出UI” ?
2025-12-22
火线解析MiniMax招股书!全球领先大模型成本只有OpenAI 1%,果然拳怕少壮
2025-12-21
Benotes:一款功能强大、易于安装和使用的开源笔记与书签一体化应用
2025-12-21
告别每月 AI 订阅费!这款开源笔记内置 Ollama,让你的电脑变身第二大脑
2025-12-20
开口跪!这款开源TTS让AI说话带“情绪”,还能多语言克隆!
2025-12-20
ollama v0.13.5 发布详解:新模型接入、引擎升级与工具能力增强
2025-11-19
2025-10-20
2025-10-27
2025-10-27
2025-10-03
2025-09-29
2025-11-17
2025-10-29
2025-09-29
2025-11-07
2025-12-22
2025-11-12
2025-11-10
2025-11-03
2025-10-29
2025-10-28
2025-10-13
2025-09-29