mirror of
https://github.com/mudler/LocalAI.git
synced 2024-06-07 19:40:48 +00:00
ab7b4d5ee9
Refactors api folder to core, creates firm split between backend code and api frontend.
26 lines
717 B
Go
26 lines
717 B
Go
package localai
|
|
|
|
import (
|
|
"github.com/go-skynet/LocalAI/core/backend"
|
|
"github.com/go-skynet/LocalAI/core/services"
|
|
"github.com/go-skynet/LocalAI/pkg/model"
|
|
"github.com/go-skynet/LocalAI/pkg/schema"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func TTSEndpoint(cl *services.ConfigLoader, ml *model.ModelLoader, so *schema.StartupOptions) func(c *fiber.Ctx) error {
|
|
return func(c *fiber.Ctx) error {
|
|
input := new(schema.TTSRequest)
|
|
// Get input data from the request body
|
|
if err := c.BodyParser(input); err != nil {
|
|
return err
|
|
}
|
|
|
|
filePath, _, err := backend.ModelTTS(input.Backend, input.Input, input.Model, ml, so)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return c.Download(filePath)
|
|
}
|
|
}
|