一个基于 SmolVLM 的多模态对话工具,支持图像理解和文本交互。
- 支持本地图片分析
- 支持摄像头实时拍照分析
- 支持流式输出
- 交互式对话模式
在这下:[https://huggingface.co/ggml-org/SmolVLM-256M-Instruct-GGUF/tree/main]
wget https://huggingface.co/ggml-org/SmolVLM-256M-Instruct-GGUF/resolve/main/SmolVLM-256M-Instruct-f16.gguf
wget https://huggingface.co/ggml-org/SmolVLM-256M-Instruct-GGUF/resolve/main/mmproj-SmolVLM-256M-Instruct-f16.gguf下载ollama[https://ollama.com/download]
ollama serveFROM ./SmolVLM-256M-Instruct-f16.gguf
ADAPTER ./mmproj-SmolVLM-256M-Instruct-Q8_0.gguf
TEMPLATE """
<|im_start|>system
{{ .System }}
<end_of_utterance>
{{- range .Messages }}
<|im_start|>{{ .Role }}:
{{ .Content }}
<end_of_utterance>
{{- end }}
<|im_start|>assistant
"""
SYSTEM "You are a visual assistant. Describe images clearly and answer questions based on visual content."
PARAMETER num_ctx 4096
PARAMETER stop "<end_of_utterance>"
PARAMETER stop "<|im_start|>"
PARAMETER temperature 0.01
ollama create smolvlm:256m -f smolvlm.modelfilepip install opencv-pythongit clone https://github.com/muggle-stack/smolvlm-api.git
cd smolvlm-apipython smolvlm-api.py --image ~/Downloads/muggle-stack.png --streampython smolvlm-api.py --camera --prompt "Descripe this image"使用摄像头时:
- 按空格键拍照
- 按ESC退出
# 使用本地图片进入交互模式
python smolvlm-api.py --image path/to/your/image.jpg
# 使用摄像头进入交互模式
python smolvlm-api.py --camera添加 --stream 参数启用流式输出:
python smolvlm-api.py --image path/to/your/image.jpg --stream--model: 指定使用的模型(默认:smolvlm:256m)--image: 指定要分析的图片路径--camera: 启用摄像头模式--prompt: 指定初始提示词--stream: 启用流式输出
- 使用摄像头时,按空格键拍照,按ESC退出
- 确保系统已正确安装并配置 Ollama
- 确保有足够的系统资源运行模型