mirror of
https://github.com/foomo/coreml-service-yolov8.git
synced 2025-10-16 12:25:42 +00:00
feat: support to read MODELS_PATH env var
This commit is contained in:
parent
928b96cc20
commit
97b19facad
@ -6,10 +6,8 @@ enum Entrypoint {
|
|||||||
static func main() async throws {
|
static func main() async throws {
|
||||||
var env = try Environment.detect()
|
var env = try Environment.detect()
|
||||||
try LoggingSystem.bootstrap(from: &env)
|
try LoggingSystem.bootstrap(from: &env)
|
||||||
|
|
||||||
let app = Application(env)
|
let app = Application(env)
|
||||||
defer { app.shutdown() }
|
defer { app.shutdown() }
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try await configure(app)
|
try await configure(app)
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
import Vapor
|
import Vapor
|
||||||
|
|
||||||
func routes(_ app: Application) throws {
|
func routes(_ app: Application) throws {
|
||||||
let recoController = RecognitionController(modelsPath: "")
|
var modelsPath = ""
|
||||||
|
if Environment.get("MODELS_PATH") != nil {
|
||||||
|
modelsPath = Environment.get("MODELS_PATH")!
|
||||||
|
}
|
||||||
|
let recoController = RecognitionController(modelsPath: modelsPath)
|
||||||
try app.register(collection: recoController)
|
try app.register(collection: recoController)
|
||||||
try recoController.loadModel()
|
try recoController.loadModel()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user