John6666 commited on
Commit
b48c540
β€’
1 Parent(s): fdace72

Upload 9 files

Browse files
Files changed (2) hide show
  1. app.py +3 -2
  2. tagger/utils.py +5 -0
app.py CHANGED
@@ -40,7 +40,7 @@ load_models(models, 5)
40
 
41
 
42
  css = """
43
- #model_info { text-align: center; display:block; }
44
  """
45
 
46
  with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
@@ -61,6 +61,7 @@ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
61
  v2_ban_tags = gr.Textbox(label="Ban tags", info="Tags to ban from the output.", placeholder="alternate costumen, ...", value="censored")
62
  v2_tag_type = gr.Radio(label="Tag Type", info="danbooru for common, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru", visible=False)
63
  v2_model = gr.Dropdown(label="Model", choices=list(V2_ALL_MODELS.keys()), value=list(V2_ALL_MODELS.keys())[0])
 
64
  with gr.Accordion("Model", open=True):
65
  model_name = gr.Dropdown(label="Select Model", show_label=False, choices=list(loaded_models.keys()), value=list(loaded_models.keys())[0], allow_custom_value=True)
66
  model_info = gr.Markdown(value=get_model_info_md(list(loaded_models.keys())[0]), elem_id="model_info")
@@ -144,7 +145,7 @@ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
144
  tagger_generate_from_image.click(
145
  predict_tags_wd,
146
  [tagger_image, prompt, tagger_algorithms, tagger_general_threshold, tagger_character_threshold],
147
- [v2_series, v2_character, prompt, gr.Button(visible=False)],
148
  show_api=False,
149
  ).success(
150
  predict_tags_fl2_sd3, [tagger_image, prompt, tagger_algorithms], [prompt], show_api=False,
 
40
 
41
 
42
  css = """
43
+ #model_info { text-align: center; }
44
  """
45
 
46
  with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo:
 
61
  v2_ban_tags = gr.Textbox(label="Ban tags", info="Tags to ban from the output.", placeholder="alternate costumen, ...", value="censored")
62
  v2_tag_type = gr.Radio(label="Tag Type", info="danbooru for common, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru", visible=False)
63
  v2_model = gr.Dropdown(label="Model", choices=list(V2_ALL_MODELS.keys()), value=list(V2_ALL_MODELS.keys())[0])
64
+ v2_copy = gr.Button(value="Copy to clipboard", size="sm", interactive=False)
65
  with gr.Accordion("Model", open=True):
66
  model_name = gr.Dropdown(label="Select Model", show_label=False, choices=list(loaded_models.keys()), value=list(loaded_models.keys())[0], allow_custom_value=True)
67
  model_info = gr.Markdown(value=get_model_info_md(list(loaded_models.keys())[0]), elem_id="model_info")
 
145
  tagger_generate_from_image.click(
146
  predict_tags_wd,
147
  [tagger_image, prompt, tagger_algorithms, tagger_general_threshold, tagger_character_threshold],
148
+ [v2_series, v2_character, prompt, v2_copy],
149
  show_api=False,
150
  ).success(
151
  predict_tags_fl2_sd3, [tagger_image, prompt, tagger_algorithms], [prompt], show_api=False,
tagger/utils.py CHANGED
@@ -43,3 +43,8 @@ COPY_ACTION_JS = """\
43
  navigator.clipboard.writeText(inputs);
44
  }
45
  }"""
 
 
 
 
 
 
43
  navigator.clipboard.writeText(inputs);
44
  }
45
  }"""
46
+
47
+
48
+ def gradio_copy_prompt(prompt: str):
49
+ gr.Info("Copied!")
50
+ return prompt