CoolFace
Apppublic

zeno-ml/diffusiondb

sourceHugging Facemitupdated 3y agoView on Hugging Face
16likes
functions.py35 linesDownload Raw Back to root
1from pandas import DataFrame2 3from zeno import (4    DistillReturn,5    MetricReturn,6    ModelReturn,7    ZenoOptions,8    distill,9    metric,10    model,11)12 13 14@model15def model_ret(name):16    def model(df: DataFrame, ops: ZenoOptions):17        return ModelReturn(model_output=df[ops.data_column])18 19    return model20 21 22@distill23def length(df: DataFrame, ops: ZenoOptions):24    return DistillReturn(distill_output=df["prompt"].str.len())25 26 27@metric28def avg_image_nswf(df: DataFrame, ops: ZenoOptions):29    return MetricReturn(metric=float(df["image_nsfw"].dropna().mean()))30 31 32@metric33def avg_prompt_nsfw(df: DataFrame, ops: ZenoOptions):34    return MetricReturn(metric=float(df["prompt_nsfw"].dropna().mean()))35