12345678910111213141516 |
- from .init_sqlalhemy import db, init_databases
- from flask import Flask
- import paddlex as pdx
- def init_plugins(app:Flask):
- init_databases(app)
- init_paddle(app)
- def init_paddle(app):
- with app.app_context():
- use_gpu=True
- if not pdx.device.is_compiled_with_cuda():
- print("PaddlePaddle is not compiled with CUDA. CPU will be used.")
- use_gpu = False
- app.pdx_model = pdx.deploy.Predictor('./core/net/inference_model', use_gpu=use_gpu)
|