aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--javascript/token-counters.js8
-rw-r--r--modules/shared.py1
2 files changed, 9 insertions, 0 deletions
diff --git a/javascript/token-counters.js b/javascript/token-counters.js
index 0b74658c..9d81a723 100644
--- a/javascript/token-counters.js
+++ b/javascript/token-counters.js
@@ -21,6 +21,9 @@ function update_img2img_tokens(...args) {
}
function update_token_counter(button_id) {
+ if (opts.disable_token_counters) {
+ return;
+ }
if (promptTokenCountTimeouts[button_id]) {
clearTimeout(promptTokenCountTimeouts[button_id]);
}
@@ -54,6 +57,11 @@ function setupTokenCounting(id, id_counter, id_button) {
var counter = gradioApp().getElementById(id_counter);
var textarea = gradioApp().querySelector(`#${id} > label > textarea`);
+ if (opts.disable_token_counters) {
+ counter.style.display = "none";
+ return;
+ }
+
if (counter.parentElement == prompt.parentElement) {
return;
}
diff --git a/modules/shared.py b/modules/shared.py
index 3099d1d2..e8dbd8a4 100644
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -487,6 +487,7 @@ options_templates.update(options_section(('ui', "User interface"), {
"ui_reorder": OptionInfo(", ".join(ui_reorder_categories), "txt2img/img2img UI item order").needs_restart(),
"hires_fix_show_sampler": OptionInfo(False, "Hires fix: show hires sampler selection").needs_restart(),
"hires_fix_show_prompts": OptionInfo(False, "Hires fix: show hires prompt and negative prompt").needs_restart(),
+ "disable_token_counters": OptionInfo(False, "Disable prompt token counters").needs_restart(),
}))
options_templates.update(options_section(('infotext', "Infotext"), {