This commit is contained in:
tuna2134
2024-09-27 12:40:38 +00:00
parent 395f5b0004
commit d380e549c4
3 changed files with 4 additions and 3 deletions

1
Cargo.lock generated
View File

@@ -2477,6 +2477,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3ab4b7269d14d93626b0bfedf212f1b0995cb7d13d35daba21d579511e7fae8"
dependencies = [
"axum",
"serde",
"serde_json",
"utoipa",

View File

@@ -13,7 +13,7 @@ sbv2_core = { version = "0.2.0-alpha", path = "../sbv2_core" }
serde = { version = "1.0.210", features = ["derive"] }
tokio = { version = "1.40.0", features = ["full"] }
utoipa = { version = "4.2.3", features = ["axum_extras"] }
utoipa-scalar = "0.1.0"
utoipa-scalar = { version = "0.1.0", features = ["axum"] }
[features]
coreml = ["sbv2_core/coreml"]

View File

@@ -19,7 +19,7 @@ use crate::error::AppResult;
#[derive(OpenApi)]
#[openapi(
paths(openapi, models, synthesize),
paths(models, synthesize),
components(schemas(SynthesizeRequest))
)]
struct ApiDoc;
@@ -164,7 +164,7 @@ async fn main() -> anyhow::Result<()> {
.route("/synthesize", post(synthesize))
.route("/models", get(models))
.with_state(AppState::new().await?)
.merge(Scalar::with_url("/docs", ApiDoc::openapi()))
.merge(Scalar::with_url("/docs", ApiDoc::openapi()));
let addr = env::var("ADDR").unwrap_or("0.0.0.0:3000".to_string());
let listener = tokio::net::TcpListener::bind(&addr).await?;
log::info!("Listening on {addr}");