Skip to content

Commit

Permalink
feat: ai video add safety check to image to video 2 (#3071)
Browse files Browse the repository at this point in the history
* add safety check to image-to-video input image

* refactor(ai): improve code syntax

This commit improves the code syntax by making the output format
generation step consistent between pipelines. It also updates the
ai-worker to the latest version.

---------

Co-authored-by: Brad P <0xb79orch@gmail.com>
  • Loading branch information
rickstaa and ad-astra-video committed May 31, 2024
1 parent 570a00b commit aa8ae45
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions core/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,9 @@ func (n *LivepeerNode) imageToVideo(ctx context.Context, req worker.ImageToVideo
Url: uri,
}

// NOTE: Seed is consistent for video; NSFW check applies to first frame only.
if len(batch) > 0 {
videos[i].Nsfw = batch[0].Nsfw
videos[i].Seed = batch[0].Seed
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/golang/protobuf v1.5.3
github.com/jaypipes/ghw v0.10.0
github.com/jaypipes/pcidb v1.0.0
github.com/livepeer/ai-worker v0.0.2
github.com/livepeer/ai-worker v0.0.3
github.com/livepeer/go-tools v0.3.6-0.20240130205227-92479de8531b
github.com/livepeer/livepeer-data v0.7.5-0.20231004073737-06f1f383fb18
github.com/livepeer/lpms v0.0.0-20240120150405-de94555cdc69
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4n
github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI=
github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo=
github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc=
github.com/livepeer/ai-worker v0.0.2 h1:Tb9RlrQy+t2Dx0SVoxuSAqeOhRE8ONAHgnKiHyo31Ss=
github.com/livepeer/ai-worker v0.0.2/go.mod h1:JvUlcQktSgkEfzotuelfw9OpjGi2qZTW/3tWB/klb/c=
github.com/livepeer/ai-worker v0.0.3 h1:dOoi6UmU5ZoGLCmOTECQ+wo7JCvLgN3mN+Hy5LHrWW0=
github.com/livepeer/ai-worker v0.0.3/go.mod h1:JvUlcQktSgkEfzotuelfw9OpjGi2qZTW/3tWB/klb/c=
github.com/livepeer/go-tools v0.3.6-0.20240130205227-92479de8531b h1:VQcnrqtCA2UROp7q8ljkh2XA/u0KRgVv0S1xoUvOweE=
github.com/livepeer/go-tools v0.3.6-0.20240130205227-92479de8531b/go.mod h1:hwJ5DKhl+pTanFWl+EUpw1H7ukPO/H+MFpgA7jjshzw=
github.com/livepeer/joy4 v0.1.2-0.20191121080656-b2fea45cbded h1:ZQlvR5RB4nfT+cOQee+WqmaDOgGtP2oDMhcVvR4L0yA=
Expand Down
8 changes: 5 additions & 3 deletions server/ai_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func processTextToImage(ctx context.Context, params aiRequestParams, req worker.
return nil, err
}

newMedia[i] = worker.Media{Nsfw: media.Nsfw, Url: newUrl, Seed: media.Seed}
newMedia[i] = worker.Media{Nsfw: media.Nsfw, Seed: media.Seed, Url: newUrl}
}

resp.Images = newMedia
Expand Down Expand Up @@ -141,7 +141,7 @@ func processImageToImage(ctx context.Context, params aiRequestParams, req worker
return nil, err
}

newMedia[i] = worker.Media{Nsfw: media.Nsfw, Url: newUrl, Seed: media.Seed}
newMedia[i] = worker.Media{Nsfw: media.Nsfw, Seed: media.Seed, Url: newUrl}
}

resp.Images = newMedia
Expand Down Expand Up @@ -221,9 +221,11 @@ func processImageToVideo(ctx context.Context, params aiRequestParams, req worker
}

videos[i] = worker.Media{
Url: newUrl,
Nsfw: media.Nsfw,
Seed: media.Seed,
Url: newUrl,
}

}

resp.Images = videos
Expand Down

0 comments on commit aa8ae45

Please sign in to comment.