use crate::api::{AppState, BackendImpl, predict}; | |
use model::data::TweetSentimentDataset; | |
use model::model::SamModel; | |
use rocket::tokio::sync::Mutex; | |
use rocket::{launch, routes}; | |
use std::sync::Arc; | |
mod api; | |
mod dtos; | |
fn rocket() -> _ { | |
let model = Arc::new(Mutex::new( | |
SamModel::<BackendImpl, TweetSentimentDataset>::new(Default::default(), "sam-artifacts"), | |
)); | |
rocket::build() | |
.manage(AppState { model }) | |
.mount("/", routes![predict]) | |
} | |