support new api
This commit is contained in:
parent
ee275f0fa5
commit
657436f80d
1 changed files with 11 additions and 2 deletions
13
src/main.rs
13
src/main.rs
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue