forked from livepeer/go-livepeer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'livepeer:master' into master
- Loading branch information
Showing
93 changed files
with
12,469 additions
and
1,282 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ jobs: | |
apt update | ||
apt install -yqq build-essential make software-properties-common | ||
add-apt-repository -y ppa:git-core/candidate | ||
apt update && apt install -yqq git zip unzip zlib1g-dev zlib1g yasm | ||
apt update && apt install -yqq git zip unzip zlib1g-dev zlib1g libzlcore-dev libz-mingw-w64-dev yasm | ||
- name: Check out code | ||
uses: actions/[email protected] | ||
|
@@ -69,7 +69,7 @@ jobs: | |
id: go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.20.4 | ||
go-version: 1.23.2 | ||
cache: true | ||
cache-dependency-path: go.sum | ||
|
||
|
@@ -100,7 +100,8 @@ jobs: | |
&& apt update \ | ||
&& apt -yqq install \ | ||
nasm clang-14 clang-tools-14 lld-14 build-essential pkg-config autoconf git python3 \ | ||
gcc-mingw-w64 libgcc-9-dev-arm64-cross mingw-w64-tools gcc-mingw-w64-x86-64 | ||
gcc-mingw-w64 libgcc-9-dev-arm64-cross mingw-w64-tools gcc-mingw-w64-x86-64 mingw-w64-x86-64-dev \ | ||
golang-goprotobuf-dev protobuf-compiler-grpc | ||
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 30 \ | ||
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 30 \ | ||
|
@@ -170,7 +171,7 @@ jobs: | |
id: go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.20.4 | ||
go-version: 1.23.2 | ||
cache: true | ||
cache-dependency-path: go.sum | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package ai | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"errors" | ||
"os" | ||
|
||
"github.com/livepeer/ai-worker/worker" | ||
) | ||
|
||
type FileWorker struct { | ||
files map[string]string | ||
} | ||
|
||
func NewFileWorker(files map[string]string) *FileWorker { | ||
return &FileWorker{files: files} | ||
} | ||
|
||
func (w *FileWorker) TextToImage(ctx context.Context, req worker.GenTextToImageJSONRequestBody) (*worker.ImageResponse, error) { | ||
Check warning on line 20 in ai/file_worker.go GitHub Actions / Run tests defined for the project
|
||
fname, ok := w.files["text-to-image"] | ||
if !ok { | ||
return nil, errors.New("text-to-image response file not found") | ||
} | ||
|
||
data, err := os.ReadFile(fname) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var resp worker.ImageResponse | ||
if err := json.Unmarshal(data, &resp); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &resp, nil | ||
} | ||
|
||
func (w *FileWorker) ImageToImage(ctx context.Context, req worker.GenImageToImageMultipartRequestBody) (*worker.ImageResponse, error) { | ||
Check warning on line 39 in ai/file_worker.go GitHub Actions / Run tests defined for the project
|
||
fname, ok := w.files["image-to-image"] | ||
if !ok { | ||
return nil, errors.New("image-to-image response file not found") | ||
} | ||
|
||
data, err := os.ReadFile(fname) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var resp worker.ImageResponse | ||
if err := json.Unmarshal(data, &resp); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &resp, nil | ||
} | ||
|
||
func (w *FileWorker) ImageToVideo(ctx context.Context, req worker.GenImageToVideoMultipartRequestBody) (*worker.VideoResponse, error) { | ||
fname, ok := w.files["image-to-video"] | ||
if !ok { | ||
return nil, errors.New("image-to-video response file not found") | ||
} | ||
|
||
data, err := os.ReadFile(fname) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var resp worker.VideoResponse | ||
if err := json.Unmarshal(data, &resp); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &resp, nil | ||
} | ||
|
||
func (w *FileWorker) Upscale(ctx context.Context, req worker.GenUpscaleMultipartRequestBody) (*worker.ImageResponse, error) { | ||
fname, ok := w.files["upscale"] | ||
if !ok { | ||
return nil, errors.New("upscale response file not found") | ||
} | ||
|
||
data, err := os.ReadFile(fname) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var resp worker.ImageResponse | ||
if err := json.Unmarshal(data, &resp); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &resp, nil | ||
} | ||
|
||
func (w *FileWorker) Warm(ctx context.Context, containerName, modelID string) error { | ||
return nil | ||
} | ||
|
||
func (w *FileWorker) Stop(ctx context.Context, containerName string) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.