From e5e66baa24258efe0c823d56bf90236ac0e975e0 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 4 May 2023 12:36:11 +0200 Subject: [PATCH] Handle `--revision refs/pr/2` better. --- router/src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/router/src/main.rs b/router/src/main.rs index 28db6071..50932cd1 100644 --- a/router/src/main.rs +++ b/router/src/main.rs @@ -258,9 +258,10 @@ fn init_logging(otlp_endpoint: Option, json_output: bool) { /// get model info from the Huggingface Hub pub async fn get_model_info(model_id: &str, revision: &str, token: Option) -> HubModelInfo { let client = reqwest::Client::new(); - let mut builder = client.get(format!( - "https://huggingface.co/api/models/{model_id}/revision/{revision}" - )); + // Poor man's urlencode + let revision = revision.replace("/", "%2F"); + let url = format!("https://huggingface.co/api/models/{model_id}/revision/{revision}"); + let mut builder = client.get(url); if let Some(token) = token { builder = builder.bearer_auth(token); }