ui for loading SD models done

This commit is contained in:
Concedo 2024-02-29 17:08:22 +08:00
parent 524ba12abd
commit 66134bb36e
3 changed files with 142 additions and 57 deletions

View file

@ -111,13 +111,35 @@ struct SDParams {
static SDParams * sd_params = nullptr;
static sd_ctx_t * sd_ctx = nullptr;
static void sd_logger_callback(enum sd_log_level_t level, const char* log, void* data) {
SDParams* params = (SDParams*)data;
if (!params->verbose && level <= SD_LOG_DEBUG) {
return;
}
if (level <= SD_LOG_INFO) {
fputs(log, stdout);
fflush(stdout);
} else {
fputs(log, stderr);
fflush(stderr);
}
}
bool sdtype_load_model(const load_sd_model_inputs inputs) {
printf("\nSelected Image Model: %s\n",inputs.model_filename);
sd_params = new SDParams();
sd_params->model_path = inputs.model_filename;
sd_params->wtype = SD_TYPE_F16;
sd_params->n_threads = -1; //use physical cores
sd_params->input_path = ""; //unused
if(inputs.debugmode==1)
{
sd_set_log_callback(sd_logger_callback, (void*)sd_params);
}
bool vae_decode_only = false;
sd_ctx = new_sd_ctx(sd_params->model_path.c_str(),