From b29f4583327c98a18eaebd98ccd6d416504128e4 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 5 Mar 2023 16:23:33 -0500 Subject: add cryptocompare API bindings Signed-off-by: Xe Iaso --- cmd/xedn/stablediffusion.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cmd') diff --git a/cmd/xedn/stablediffusion.go b/cmd/xedn/stablediffusion.go index 6bc18c0..0b8c3cf 100644 --- a/cmd/xedn/stablediffusion.go +++ b/cmd/xedn/stablediffusion.go @@ -3,6 +3,7 @@ package main import ( "bytes" "context" + "expvar" "fmt" "image" "image/jpeg" @@ -20,6 +21,11 @@ import ( "within.website/x/internal/stablediffusion" ) +var ( + stableDiffusionHits = expvar.NewInt("xedn_avatar_hits") + stableDiffusionCreation = expvar.NewInt("xedn_avatar_creation") +) + type StableDiffusion struct { client *stablediffusion.Client db *bbolt.DB @@ -55,6 +61,8 @@ func (sd *StableDiffusion) RenderImage(ctx context.Context, w http.ResponseWrite return nil, err } + stableDiffusionCreation.Add(1) + img, _, err := image.Decode(bytes.NewBuffer(imgs.Images[0])) if err != nil { return nil, err @@ -140,6 +148,8 @@ func (sd *StableDiffusion) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Write(data) } + stableDiffusionHits.Add(1) + return nil }) -- cgit v1.2.3