server: add webp image input support (#10653)

This commit is contained in:
Jeffrey Morgan
2025-05-12 20:41:42 -07:00
committed by GitHub
parent 526b2ed102
commit c7f4ae7b9c
3 changed files with 24 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ import (
"encoding/json"
"errors"
"fmt"
"image"
"io"
"io/fs"
"log/slog"
@@ -25,6 +26,7 @@ import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"golang.org/x/image/webp"
"golang.org/x/sync/errgroup"
"github.com/ollama/ollama/api"
@@ -1304,6 +1306,10 @@ func Serve(ln net.Listener) error {
s.sched.Run(schedCtx)
// register the experimental webp decoder
// so webp images can be used in multimodal inputs
image.RegisterFormat("webp", "RIFF????WEBP", webp.Decode, webp.DecodeConfig)
// At startup we retrieve GPU information so we can get log messages before loading a model
// This will log warnings to the log in case we have problems with detected GPUs
gpus := discover.GetGPUInfo()