support new api

This commit is contained in:
Luna 2024-08-04 18:36:56 -03:00
parent ee275f0fa5
commit 657436f80d

View file

@ -95,7 +95,13 @@ where
#[derive(Serialize, Deserialize)]
struct WD14Response {
caption: HashMap<String, f32>,
caption: WD14ResponseTagHolder,
}
#[derive(Serialize, Deserialize)]
struct WD14ResponseTagHolder {
tag: HashMap<String, f32>,
rating: HashMap<String, f32>,
}
async fn send_image_to_dd(
@ -159,7 +165,10 @@ async fn send_image_to_dd(
// turn WD14Response into WrappedResponse
let mut tags = Vec::<String>::new();
for ele in json_response.caption {
for ele in json_response.caption.tag {
tags.push(ele.0.clone());
}
for ele in json_response.caption.rating {
tags.push(ele.0.clone());
}