Skip to content

feat(video-gen): add endpoint for video generation #5247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

mudler
Copy link
Owner

@mudler mudler commented Apr 26, 2025

Description

This PR adds endpoint and grpc methods to handle video generation. Preparation needed for https://github.com/lllyasviel/FramePack

Notes for Reviewers

This PR also refactors directory where we store generated content: we know default to a directory which contains all the formats (audio, video, images, ...)

Part of #5248

Signed commits

  • Yes, I signed my commits.

Copy link

netlify bot commented Apr 26, 2025

Deploy Preview for localai ready!

Name Link
🔨 Latest commit a420fca
🔍 Latest deploy log https://app.netlify.com/sites/localai/deploys/680cdc472e42980008577367
😎 Deploy Preview https://deploy-preview-5247--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

router.Static("/generated-images", application.ApplicationConfig().ImageDir)
}
if application.ApplicationConfig().GeneratedContentDir != "" {
os.MkdirAll(application.ApplicationConfig().GeneratedContentDir, 0750)

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled
imagePath := filepath.Join(application.ApplicationConfig().GeneratedContentDir, "images")
videoPath := filepath.Join(application.ApplicationConfig().GeneratedContentDir, "videos")

os.MkdirAll(audioPath, 0750)

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled
videoPath := filepath.Join(application.ApplicationConfig().GeneratedContentDir, "videos")

os.MkdirAll(audioPath, 0750)
os.MkdirAll(imagePath, 0750)

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled

os.MkdirAll(audioPath, 0750)
os.MkdirAll(imagePath, 0750)
os.MkdirAll(videoPath, 0750)

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled

func downloadFile(url string) (string, error) {
// Get the data
resp, err := http.Get(url)

Check failure

Code scanning / gosec

Potential HTTP request made with variable url Error

Potential HTTP request made with variable url
}
defer os.RemoveAll(out)

fileData, err = os.ReadFile(out)

Check failure

Code scanning / gosec

Potential file inclusion via variable Error

Potential file inclusion via variable
writer := bufio.NewWriter(outputFile)
_, err = writer.Write(fileData)
if err != nil {
outputFile.Close()

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled
outputFile.Close()
return err
}
outputFile.Close()

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled

if b64JSON {
defer os.RemoveAll(output)
data, err := os.ReadFile(output)

Check failure

Code scanning / gosec

Potential file inclusion via variable Error

Potential file inclusion via variable
@mudler mudler force-pushed the feat/video-endpoint branch from ee740ea to a420fca Compare April 26, 2025 13:14
if err != nil {
return err
}
outputFile.Close()

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled
@mudler mudler merged commit 2c9279a into master Apr 26, 2025
24 of 25 checks passed
@mudler mudler deleted the feat/video-endpoint branch April 26, 2025 16:05
@mudler mudler added the enhancement New feature or request label May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant