Spaces:
Running
Running
import gradio as gr | |
from danbooru_to_ja import danbooru_to_ja | |
DESCRIPTION_MD = """ | |
# Convert Danbooru tags and E621 tags to Japanese tags V2 | |
- [A CLI version of this tool is available here](https://huggingface.co/spaces/John6666/danbooru-to-ja-v2/tree/main/local). | |
""".strip() | |
DESCRIPTION_MD2 = """ | |
The dictionary was generated using the following repository: | |
- [p1atdev/danbooru-ja-tag-pair-20240715](https://huggingface.co/datasets/p1atdev/danbooru-ja-tag-pair-20240715) | |
- [ponapon280/danbooru-e621-converter](https://github.com/ponapon280/danbooru-e621-converter) | |
""".strip() | |
css = """""" | |
with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", css=css) as demo: | |
gr.Markdown(DESCRIPTION_MD) | |
with gr.Column(): | |
input_tag = gr.Textbox(label="Input tag", placeholder="1girl, solo, sitting, ...", value="", lines=4) | |
is_append = gr.Checkbox(label="Append input tag to output", value=True) | |
run_button = gr.Button(value="Convert") | |
output_tag = gr.Textbox(label="Output tag", value="", lines=4, interactive=False, show_copy_button=True) | |
gr.Markdown(DESCRIPTION_MD2) | |
gr.on( | |
triggers=[input_tag.submit, run_button.click], | |
fn=danbooru_to_ja, | |
inputs=[input_tag, gr.Textbox(visible=False), gr.Textbox(visible=False), is_append], | |
outputs=[output_tag], | |
) | |
demo.queue() | |
demo.launch() | |