Skip to content

Commit 5785ec4

Browse files
committed
Try adding photomaker support
1 parent d691c62 commit 5785ec4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

examples/server/main.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct SDParams {
6363
int n_threads = -1;
6464
SDMode mode = TXT2IMG;
6565

66+
// models
6667
std::string model_path;
6768
std::string clip_l_path;
6869
std::string t5xxl_path;
@@ -71,8 +72,9 @@ struct SDParams {
7172
// std::string taesd_path;
7273
std::string embeddings_path;
7374
std::string stacked_id_embeddings_path;
74-
sd_type_t wtype = SD_TYPE_COUNT;
7575
std::string lora_model_dir;
76+
77+
sd_type_t wtype = SD_TYPE_COUNT;
7678
std::string output_path = "output.png";
7779
std::string input_path;
7880

@@ -100,6 +102,9 @@ struct SDParams {
100102
bool vae_on_cpu = false;
101103
bool color = false;
102104

105+
// Photomaker params
106+
std::string input_id_images_path;
107+
103108
// server things
104109
int port = 8080;
105110
std::string host = "127.0.0.1";
@@ -660,17 +665,24 @@ void parseJsonPrompt(std::string json_str, SDParams* params) {
660665

661666
try {
662667
std::string control_cond = payload["control_cond"];
668+
663669
// TODO map to enum value
664670
// LOG_WARN("control_cond is not supported yet\n");
665671
sd_log(sd_log_level_t::SD_LOG_WARN, "control_cond is not supported yet\n");
666672
} catch (...) {
667673
}
668674
try {
669675
float control_strength = payload["control_strength"];
676+
// params->control_strength = control_strength;
677+
// LOG_WARN("control_strength is not supported yet\n");
678+
sd_log(sd_log_level_t::SD_LOG_WARN, "control_strength is not supported yet\n", params);
670679
} catch (...) {
671680
}
672681
try {
673682
float style_strength = payload["style_strength"];
683+
// params->style_strength = style_strength;
684+
// LOG_WARN("style_strength is not supported yet\n");
685+
sd_log(sd_log_level_t::SD_LOG_WARN, "style_strength is not supported yet\n", params);
674686
} catch (...) {
675687
}
676688
try {
@@ -681,6 +693,7 @@ void parseJsonPrompt(std::string json_str, SDParams* params) {
681693
try {
682694
std::string input_id_images_path = payload["input_id_images_path"];
683695
// TODO replace with b64 image maybe?
696+
params->input_id_images_path = input_id_images_path;
684697
} catch (...) {
685698
}
686699
}
@@ -774,7 +787,7 @@ int main(int argc, const char* argv[]) {
774787
1,
775788
params.style_ratio,
776789
params.normalize_input,
777-
"");
790+
params.input_id_images_path.c_str());
778791

779792
if (results == NULL) {
780793
printf("generate failed\n");

0 commit comments

Comments
 (0)