Skip to content

Commit

Permalink
Try adding photomaker support
Browse files Browse the repository at this point in the history
  • Loading branch information
stduhpf committed Oct 22, 2024
1 parent 1c59983 commit d0704a5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions examples/server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct SDParams {
int n_threads = -1;
SDMode mode = TXT2IMG;

// models
std::string model_path;
std::string clip_l_path;
std::string t5xxl_path;
Expand All @@ -71,8 +72,9 @@ struct SDParams {
// std::string taesd_path;
std::string embeddings_path;
std::string stacked_id_embeddings_path;
sd_type_t wtype = SD_TYPE_COUNT;
std::string lora_model_dir;

sd_type_t wtype = SD_TYPE_COUNT;
std::string output_path = "output.png";
std::string input_path;

Expand Down Expand Up @@ -100,6 +102,9 @@ struct SDParams {
bool vae_on_cpu = false;
bool color = false;

// Photomaker params
std::string input_id_images_path;

// server things
int port = 8080;
std::string host = "127.0.0.1";
Expand Down Expand Up @@ -660,17 +665,24 @@ void parseJsonPrompt(std::string json_str, SDParams* params) {

try {
std::string control_cond = payload["control_cond"];

// TODO map to enum value
// LOG_WARN("control_cond is not supported yet\n");
sd_log(sd_log_level_t::SD_LOG_WARN, "control_cond is not supported yet\n");
} catch (...) {
}
try {
float control_strength = payload["control_strength"];
// params->control_strength = control_strength;
// LOG_WARN("control_strength is not supported yet\n");
sd_log(sd_log_level_t::SD_LOG_WARN, "control_strength is not supported yet\n", params);
} catch (...) {
}
try {
float style_strength = payload["style_strength"];
// params->style_strength = style_strength;
// LOG_WARN("style_strength is not supported yet\n");
sd_log(sd_log_level_t::SD_LOG_WARN, "style_strength is not supported yet\n", params);
} catch (...) {
}
try {
Expand All @@ -681,6 +693,7 @@ void parseJsonPrompt(std::string json_str, SDParams* params) {
try {
std::string input_id_images_path = payload["input_id_images_path"];
// TODO replace with b64 image maybe?
params->input_id_images_path = input_id_images_path;
} catch (...) {
}
}
Expand Down Expand Up @@ -774,7 +787,7 @@ int main(int argc, const char* argv[]) {
1,
params.style_ratio,
params.normalize_input,
"");
params.input_id_images_path.c_str());

if (results == NULL) {
printf("generate failed\n");
Expand Down

0 comments on commit d0704a5

Please sign in to comment.