feat: ensure model exist before serving (#180)
* chore: migrate completion to new metadata format * feat: ensure model exist before servingsupport-coreml
parent
9131567257
commit
ca077a3403
|
|
@ -57,7 +57,7 @@ impl metadata::Metadata {
|
|||
}
|
||||
}
|
||||
|
||||
async fn download_model(model_id: &str, prefer_local_file: bool) -> Result<()> {
|
||||
pub async fn download_model(model_id: &str, prefer_local_file: bool) -> Result<()> {
|
||||
let mut metadata = metadata::Metadata::from(model_id).await?;
|
||||
|
||||
metadata
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ pub struct ServeArgs {
|
|||
|
||||
pub async fn main(args: &ServeArgs) -> Result<()> {
|
||||
valid_args(args)?;
|
||||
|
||||
// Ensure model exists.
|
||||
crate::download::download_model(&args.model, true).await?;
|
||||
|
||||
let app = Router::new()
|
||||
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi()))
|
||||
.nest("/v1", api_router(args))
|
||||
|
|
|
|||
Loading…
Reference in New Issue