Upload 13 files
Browse filesFiles changed (4)
- app.py+21-15
- multit2i.py+57-27
- requirements.txt+1-3
- tagger/tagger.py+21-21
2 unmodified lines345678928 unmodified lines3839404142434 unmodified lines48495051525354555657585960616263646566676869707172737475767778798029 unmodified lines1101111121131141151161171181 unmodified line1201211221231241251261271281291301311321331341351361371382 unmodified linesfrom multit2i import (load_models, infer_fn, infer_rand_fn, save_gallery,change_model, warm_model, get_model_info_md, loaded_models,get_positive_prefix, get_positive_suffix, get_negative_prefix, get_negative_suffix,get_recom_prompt_type, set_recom_prompt_preset, get_tag_type)from tagger.tagger import (predict_tags_wd, remove_specific_prompt, convert_danbooru_to_e621_prompt,insert_recom_prompt, compose_prompt_to_copy)from tagger.fl2sd3longcap import predict_tags_fl2_sd328 unmodified linestagger_algorithms = gr.CheckboxGroup(["Use WD Tagger", "Use Florence-2-SD3-Long-Captioner"], label="Algorithms", value=["Use WD Tagger"])tagger_generate_from_image = gr.Button(value="Generate Tags from Image", variant="secondary")with gr.Accordion("Prompt Transformer", open=False):with gr.Row():v2_rating = gr.Radio(label="Rating", choices=list(V2_RATING_OPTIONS), value="sfw")v2_aspect_ratio = gr.Radio(label="Aspect ratio", info="The aspect ratio of the image.", choices=list(V2_ASPECT_RATIO_OPTIONS), value="square", visible=False)4 unmodified linesv2_tag_type = gr.Radio(label="Tag Type", info="danbooru for common, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru", visible=False)v2_model = gr.Dropdown(label="Model", choices=list(V2_ALL_MODELS.keys()), value=list(V2_ALL_MODELS.keys())[0])v2_copy = gr.Button(value="Copy to clipboard", variant="secondary", size="sm", interactive=False)with gr.Row():v2_character = gr.Textbox(label="Character", placeholder="hatsune miku", scale=2)v2_series = gr.Textbox(label="Series", placeholder="vocaloid", scale=2)random_prompt = gr.Button(value="Extend Prompt 🎲", variant="secondary", size="sm", scale=1)clear_prompt = gr.Button(value="Clear Prompt 🗑️", variant="secondary", size="sm", scale=1)prompt = gr.Text(label="Prompt", lines=2, max_lines=8, placeholder="1girl, solo, ...", show_copy_button=True)with gr.Accordion("Advanced options", open=False):neg_prompt = gr.Text(label="Negative Prompt", lines=1, max_lines=8, placeholder="")with gr.Row():width = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=1216, step=32, value=0)height = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=1216, step=32, value=0)with gr.Row():steps = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0)cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0)seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1)recom_prompt_preset = gr.Radio(label="Set Presets", choices=get_recom_prompt_type(), value="Common")with gr.Row():positive_prefix = gr.CheckboxGroup(label="Use Positive Prefix", choices=get_positive_prefix(), value=[])positive_suffix = gr.CheckboxGroup(label="Use Positive Suffix", choices=get_positive_suffix(), value=["Common"])negative_prefix = gr.CheckboxGroup(label="Use Negative Prefix", choices=get_negative_prefix(), value=[])negative_suffix = gr.CheckboxGroup(label="Use Negative Suffix", choices=get_negative_suffix(), value=["Common"])image_num = gr.Slider(label="Number of images", minimum=1, maximum=max_images, value=1, step=1, interactive=True, scale=1)with gr.Row():run_button = gr.Button("Generate Image", variant="primary", scale=6)random_button = gr.Button("Random Model 🎲", variant="secondary", scale=3)stop_button = gr.Button('Stop', variant="stop", interactive=False, scale=1)with gr.Group():model_name = gr.Dropdown(label="Select Model", choices=list(loaded_models.keys()), value=list(loaded_models.keys())[0], allow_custom_value=True)model_info = gr.Markdown(value=get_model_info_md(list(loaded_models.keys())[0]), elem_classes="model_info")29 unmodified linesgr.DuplicateButton(value="Duplicate Space")gr.Markdown(f"Just a few edits to *model.py* are all it takes to complete your own collection.")gr.on(triggers=[run_button.click, prompt.submit, random_button.click], fn=lambda: gr.update(interactive=True), inputs=None, outputs=stop_button, show_api=False)model_name.change(change_model, [model_name], [model_info], queue=False, show_api=False)\.success(warm_model, [model_name], None, queue=True, show_api=False)for i, o in enumerate(output):img_i = gr.Number(i, visible=False)image_num.change(lambda i, n: gr.update(visible = (i < n)), [img_i, image_num], o, show_api=False)1 unmodified linefn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,positive_prefix, positive_suffix, negative_prefix, negative_suffix],outputs=[o], queue=True, show_api=False)gen_event2 = gr.on(triggers=[random_button.click],fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_rand_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,positive_prefix, positive_suffix, negative_prefix, negative_suffix],outputs=[o], queue=True, show_api=False)o.change(save_gallery, [o, results], [results, image_files], show_api=False)stop_button.click(lambda: gr.update(interactive=False), None, stop_button, cancels=[gen_event, gen_event2], show_api=False)clear_prompt.click(lambda: None, None, [prompt], queue=False, show_api=False)clear_results.click(lambda: (None, None), None, [results, image_files], queue=False, show_api=False)recom_prompt_preset.change(set_recom_prompt_preset, [recom_prompt_preset],[positive_prefix, positive_suffix, negative_prefix, negative_suffix], queue=False, show_api=False)random_prompt.click(v2_random_prompt, [prompt, v2_series, v2_character, v2_rating, v2_aspect_ratio, v2_length,2 unmodified lines345678928 unmodified lines3839404142434445464 unmodified lines51525354555657585960616263646566676869707172737475767778798081828329 unmodified lines1131141151161171181191201211 unmodified line1231241251261271281291301311321331341351361371381391401411421431442 unmodified linesfrom multit2i import (load_models, infer_fn, infer_rand_fn, save_gallery,change_model, warm_model, get_model_info_md, loaded_models,get_positive_prefix, get_positive_suffix, get_negative_prefix, get_negative_suffix,get_recom_prompt_type, set_recom_prompt_preset, get_tag_type, randomize_seed, translate_to_en)from tagger.tagger import (predict_tags_wd, remove_specific_prompt, convert_danbooru_to_e621_prompt,insert_recom_prompt, compose_prompt_to_copy)from tagger.fl2sd3longcap import predict_tags_fl2_sd328 unmodified linestagger_algorithms = gr.CheckboxGroup(["Use WD Tagger", "Use Florence-2-SD3-Long-Captioner"], label="Algorithms", value=["Use WD Tagger"])tagger_generate_from_image = gr.Button(value="Generate Tags from Image", variant="secondary")with gr.Accordion("Prompt Transformer", open=False):with gr.Row():v2_character = gr.Textbox(label="Character", placeholder="hatsune miku", scale=2)v2_series = gr.Textbox(label="Series", placeholder="vocaloid", scale=2)with gr.Row():v2_rating = gr.Radio(label="Rating", choices=list(V2_RATING_OPTIONS), value="sfw")v2_aspect_ratio = gr.Radio(label="Aspect ratio", info="The aspect ratio of the image.", choices=list(V2_ASPECT_RATIO_OPTIONS), value="square", visible=False)4 unmodified linesv2_tag_type = gr.Radio(label="Tag Type", info="danbooru for common, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru", visible=False)v2_model = gr.Dropdown(label="Model", choices=list(V2_ALL_MODELS.keys()), value=list(V2_ALL_MODELS.keys())[0])v2_copy = gr.Button(value="Copy to clipboard", variant="secondary", size="sm", interactive=False)random_prompt = gr.Button(value="Extend 🎲", variant="secondary")prompt = gr.Text(label="Prompt", lines=2, max_lines=8, placeholder="1girl, solo, ...", show_copy_button=True)with gr.Accordion("Advanced options", open=False):neg_prompt = gr.Text(label="Negative Prompt", lines=1, max_lines=8, placeholder="")with gr.Row():width = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=1216, step=32, value=0)height = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=1216, step=32, value=0)steps = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0)with gr.Row():cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0)seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1)seed_rand = gr.Button("Randomize Seed 🎲", size="sm", variant="secondary")recom_prompt_preset = gr.Radio(label="Set Presets", choices=get_recom_prompt_type(), value="Common")with gr.Row():positive_prefix = gr.CheckboxGroup(label="Use Positive Prefix", choices=get_positive_prefix(), value=[])positive_suffix = gr.CheckboxGroup(label="Use Positive Suffix", choices=get_positive_suffix(), value=["Common"])negative_prefix = gr.CheckboxGroup(label="Use Negative Prefix", choices=get_negative_prefix(), value=[])negative_suffix = gr.CheckboxGroup(label="Use Negative Suffix", choices=get_negative_suffix(), value=["Common"])with gr.Row():image_num = gr.Slider(label="Number of images", minimum=1, maximum=max_images, value=1, step=1, interactive=True, scale=2)trans_prompt = gr.Button(value="Translate 📝", variant="secondary", size="sm", scale=2)clear_prompt = gr.Button(value="Clear 🗑️", variant="secondary", size="sm", scale=1)with gr.Row():run_button = gr.Button("Generate Image", variant="primary", scale=6)random_button = gr.Button("Random Model 🎲", variant="secondary", scale=3)#stop_button = gr.Button('Stop', variant="stop", interactive=False, scale=1)with gr.Group():model_name = gr.Dropdown(label="Select Model", choices=list(loaded_models.keys()), value=list(loaded_models.keys())[0], allow_custom_value=True)model_info = gr.Markdown(value=get_model_info_md(list(loaded_models.keys())[0]), elem_classes="model_info")29 unmodified linesgr.DuplicateButton(value="Duplicate Space")gr.Markdown(f"Just a few edits to *model.py* are all it takes to complete your own collection.")#gr.on(triggers=[run_button.click, prompt.submit, random_button.click], fn=lambda: gr.update(interactive=True), inputs=None, outputs=stop_button, show_api=False)model_name.change(change_model, [model_name], [model_info], queue=False, show_api=False)\.success(warm_model, [model_name], None, queue=False, show_api=False)for i, o in enumerate(output):img_i = gr.Number(i, visible=False)image_num.change(lambda i, n: gr.update(visible = (i < n)), [img_i, image_num], o, show_api=False)1 unmodified linefn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,positive_prefix, positive_suffix, negative_prefix, negative_suffix],outputs=[o], queue=False, show_api=False) # Be sure to delete ", queue=False" when activating the stop buttongen_event2 = gr.on(triggers=[random_button.click],fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4: infer_rand_fn(m, t1, t2, n1, n2, n3, n4, n5, l1, l2, l3, l4) if (i < n) else None,inputs=[img_i, image_num, model_name, prompt, neg_prompt, height, width, steps, cfg, seed,positive_prefix, positive_suffix, negative_prefix, negative_suffix],outputs=[o], queue=False, show_api=False) # Be sure to delete ", queue=False" when activating the stop buttono.change(save_gallery, [o, results], [results, image_files], show_api=False)#stop_button.click(lambda: gr.update(interactive=False), None, stop_button, cancels=[gen_event, gen_event2], show_api=False)clear_prompt.click(lambda: None, None, [prompt], queue=False, show_api=False)clear_results.click(lambda: (None, None), None, [results, image_files], queue=False, show_api=False)recom_prompt_preset.change(set_recom_prompt_preset, [recom_prompt_preset],[positive_prefix, positive_suffix, negative_prefix, negative_suffix], queue=False, show_api=False)seed_rand.click(randomize_seed, None, [seed], queue=False, show_api=False)trans_prompt.click(translate_to_en, [prompt], [prompt], queue=False, show_api=False)\.then(translate_to_en, [neg_prompt], [neg_prompt], queue=False, show_api=False)random_prompt.click(v2_random_prompt, [prompt, v2_series, v2_character, v2_rating, v2_aspect_ratio, v2_length,
59 unmodified lines6061626364656643 unmodified lines1101111121131141151161 unmodified line118119120121122123124238 unmodified lines3633643653663673683693703713723733743753763773781 unmodified line38038138238338438538638738838939039139239339439539639739839940040140240340440517 unmodified lines42342442542642742842943015 unmodified lines44644744844945045145245316 unmodified lines47047147259 unmodified lineslimit = limit * 20 if check_status and force_gpu else limit * 5models = []try:model_infos = api.list_models(author=author, task="text-to-image",tags=list_uniq(default_tags + tags), cardData=True, sort=sort, limit=limit)except Exception as e:print(f"Error: Failed to list models.")43 unmodified linesdef rename_image(image_path: str | None, model_name: str, save_path: str | None = None):from PIL import Imagefrom datetime import datetime, timezone, timedeltaif image_path is None: return Nonedt_now = datetime.now(timezone(timedelta(hours=9)))1 unmodified linetry:if Path(image_path).exists():png_path = "image.png"Image.open(image_path).convert('RGBA').save(png_path, "PNG")if save_path is not None:new_path = str(Path(png_path).resolve().rename(Path(save_path).resolve()))else:238 unmodified lines# https://huggingface.co/docs/api-inference/detailed_parameters# https://huggingface.co/docs/huggingface_hub/package_reference/inference_clientdef infer_body(client: InferenceClient | gr.Interface | object, prompt: str, neg_prompt: str | None = None,height: int | None = None, width: int | None = None,steps: int | None = None, cfg: int | None = None, seed: int = -1):png_path = "image.png"kwargs = {}if height is not None and height >= 256: kwargs["height"] = heightif width is not None and width >= 256: kwargs["width"] = widthif steps is not None and steps >= 1: kwargs["num_inference_steps"] = stepsif cfg is not None and cfg > 0: cfg = kwargs["guidance_scale"] = cfgif seed >= 0: kwargs["seed"] = seedtry:if isinstance(client, InferenceClient):image = client.text_to_image(prompt=prompt, negative_prompt=neg_prompt, **kwargs, token=HF_TOKEN)1 unmodified lineimage = client.fn(prompt=prompt, negative_prompt=neg_prompt, **kwargs, token=HF_TOKEN)else: return Noneif isinstance(image, tuple): return Noneimage.save(png_path)return str(Path(png_path).resolve())except Exception as e:print(e)raise Exception() from easync def infer(model_name: str, prompt: str, neg_prompt: str | None = None,height: int | None = None, width: int | None = None,steps: int | None = None, cfg: int | None = None, seed: int = -1,save_path: str | None = None, timeout: float = inference_timeout):import randomnoise = ""if seed < 0:rand = random.randint(1, 500)for i in range(rand):noise += " "model = load_model(model_name)if not model: return Nonetask = asyncio.create_task(asyncio.to_thread(infer_body, model, f"{prompt} {noise}", neg_prompt,height, width, steps, cfg, seed))await asyncio.sleep(0)try:17 unmodified lines# https://github.com/aio-libs/pytest-aiohttp/issues/8 # also AsyncInferenceClient is buggy.def infer_fn(model_name: str, prompt: str, neg_prompt: str | None = None, height: int | None = None,width: int | None = None, steps: int | None = None, cfg: int | None = None, seed: int = -1,pos_pre: list = [], pos_suf: list = [], neg_pre: list = [], neg_suf: list = [], save_path: str | None = None):if model_name == 'NA':return None15 unmodified linesreturn resultdef infer_rand_fn(model_name_dummy: str, prompt: str, neg_prompt: str | None = None, height: int | None = None,width: int | None = None, steps: int | None = None, cfg: int | None = None, seed: int = -1,pos_pre: list = [], pos_suf: list = [], neg_pre: list = [], neg_suf: list = [], save_path: str | None = None):import randomif model_name_dummy == 'NA':16 unmodified linesfinally:loop.close()return result59 unmodified lines6061626364656643 unmodified lines1101111121131141151161 unmodified line118119120121122123124238 unmodified lines3633643653663673683693703713723733743753763773781 unmodified line38038138238338438538638738838939039139239339439539639717 unmodified lines41541641741841942042142215 unmodified lines43843944044144244344444516 unmodified lines46246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150259 unmodified lineslimit = limit * 20 if check_status and force_gpu else limit * 5models = []try:model_infos = api.list_models(author=author, #task="text-to-image",tags=list_uniq(default_tags + tags), cardData=True, sort=sort, limit=limit)except Exception as e:print(f"Error: Failed to list models.")43 unmodified linesdef rename_image(image_path: str | None, model_name: str, save_path: str | None = None):import shutilfrom datetime import datetime, timezone, timedeltaif image_path is None: return Nonedt_now = datetime.now(timezone(timedelta(hours=9)))1 unmodified linetry:if Path(image_path).exists():png_path = "image.png"if str(Path(image_path).resolve()) != str(Path(png_path).resolve()): shutil.copy(image_path, png_path)if save_path is not None:new_path = str(Path(png_path).resolve().rename(Path(save_path).resolve()))else:238 unmodified lines# https://huggingface.co/docs/api-inference/detailed_parameters# https://huggingface.co/docs/huggingface_hub/package_reference/inference_clientdef infer_body(client: InferenceClient | gr.Interface | object, model_str: str, prompt: str, neg_prompt: str = "",height: int = 0, width: int = 0, steps: int = 0, cfg: int = 0, seed: int = -1):png_path = "image.png"kwargs = {}if height > 0: kwargs["height"] = heightif width > 0: kwargs["width"] = widthif steps > 0: kwargs["num_inference_steps"] = stepsif cfg > 0: cfg = kwargs["guidance_scale"] = cfgif seed == -1: kwargs["seed"] = randomize_seed()else: kwargs["seed"] = seedtry:if isinstance(client, InferenceClient):image = client.text_to_image(prompt=prompt, negative_prompt=neg_prompt, **kwargs, token=HF_TOKEN)1 unmodified lineimage = client.fn(prompt=prompt, negative_prompt=neg_prompt, **kwargs, token=HF_TOKEN)else: return Noneif isinstance(image, tuple): return Nonereturn save_image(image, png_path, model_str, prompt, neg_prompt, height, width, steps, cfg, seed)except Exception as e:print(e)raise Exception() from easync def infer(model_name: str, prompt: str, neg_prompt: str ="", height: int = 0, width: int = 0,steps: int = 0, cfg: int = 0, seed: int = -1,save_path: str | None = None, timeout: float = inference_timeout):model = load_model(model_name)if not model: return Nonetask = asyncio.create_task(asyncio.to_thread(infer_body, model, model_name, prompt, neg_prompt,height, width, steps, cfg, seed))await asyncio.sleep(0)try:17 unmodified lines# https://github.com/aio-libs/pytest-aiohttp/issues/8 # also AsyncInferenceClient is buggy.def infer_fn(model_name: str, prompt: str, neg_prompt: str = "", height: int = 0, width: int = 0,steps: int = 0, cfg: int = 0, seed: int = -1,pos_pre: list = [], pos_suf: list = [], neg_pre: list = [], neg_suf: list = [], save_path: str | None = None):if model_name == 'NA':return None15 unmodified linesreturn resultdef infer_rand_fn(model_name_dummy: str, prompt: str, neg_prompt: str = "", height: int = 0, width: int = 0,steps: int = 0, cfg: int = 0, seed: int = -1,pos_pre: list = [], pos_suf: list = [], neg_pre: list = [], neg_suf: list = [], save_path: str | None = None):import randomif model_name_dummy == 'NA':16 unmodified linesfinally:loop.close()return resultdef save_image(image, savefile, modelname, prompt, nprompt, height=0, width=0, steps=0, cfg=0, seed=-1):from PIL import Image, PngImagePluginimport jsontry:metadata = {"prompt": prompt, "negative_prompt": nprompt, "Model": {"Model": modelname.split("/")[-1]}}if steps > 0: metadata["num_inference_steps"] = stepsif cfg > 0: metadata["guidance_scale"] = cfgif seed != -1: metadata["seed"] = seedif width > 0 and height > 0: metadata["resolution"] = f"{width} x {height}"metadata_str = json.dumps(metadata)info = PngImagePlugin.PngInfo()info.add_text("metadata", metadata_str)image.save(savefile, "PNG", pnginfo=info)return str(Path(savefile).resolve())except Exception as e:print(f"Failed to save image file: {e}")raise Exception(f"Failed to save image file:") from edef randomize_seed():from random import seed, randintMAX_SEED = 2**32-1seed()rseed = randint(0, MAX_SEED)return rseedfrom translatepy import Translatortranslator = Translator()def translate_to_en(input: str):try:output = str(translator.translate(input, 'English'))except Exception as e:output = inputprint(e)return output
5 unmodified lines67891011125 unmodified linesoptimum[onnxruntime]spacesdartrshttpx==0.13.3httpcoregoogletrans==4.0.0rc1timm5 unmodified lines6789105 unmodified linesoptimum[onnxruntime]spacesdartrstranslatepytimm
1 unmodified line234567891011178 unmodified lines19019119219319419519619719819920020120220320420520620715 unmodified lines2232242252262272282292302312322332342352362372382392401 unmodified linefrom PIL import Imageimport torchimport gradio as grfrom transformers import (AutoImageProcessor,AutoModelForImageClassification,)from pathlib import Path178 unmodified linesreturn output_promptdef translate_prompt(prompt: str = ""):def translate_to_english(prompt):import httpcoresetattr(httpcore, 'SyncHTTPTransport', 'AsyncHTTPProxy')from googletrans import Translatortranslator = Translator()try:translated_prompt = translator.translate(prompt, src='auto', dest='en').textreturn translated_promptexcept Exception as e:print(e)return promptdef is_japanese(s):import unicodedata15 unmodified linesreturn ", ".join(outputs)def translate_prompt_to_ja(prompt: str = ""):def translate_to_japanese(prompt):import httpcoresetattr(httpcore, 'SyncHTTPTransport', 'AsyncHTTPProxy')from googletrans import Translatortranslator = Translator()try:translated_prompt = translator.translate(prompt, src='en', dest='ja').textreturn translated_promptexcept Exception as e:print(e)return promptdef is_japanese(s):import unicodedata1 unmodified line2345678178 unmodified lines18718818919019119219319419519619719819920020120215 unmodified lines2182192202212222232242252262272282292302312322332342352362372382392401 unmodified linefrom PIL import Imageimport torchimport gradio as grfrom transformers import AutoImageProcessor, AutoModelForImageClassificationfrom pathlib import Path178 unmodified linesreturn output_promptfrom translatepy import Translatortranslator = Translator()def translate_prompt_old(prompt: str = ""):def translate_to_english(input: str):try:output = str(translator.translate(input, 'English'))except Exception as e:output = inputprint(e)return outputdef is_japanese(s):import unicodedata15 unmodified linesreturn ", ".join(outputs)def translate_prompt(input: str):try:output = str(translator.translate(input, 'English'))except Exception as e:output = inputprint(e)return outputdef translate_prompt_to_ja(prompt: str = ""):def translate_to_japanese(input: str):try:output = str(translator.translate(input, 'Japanese'))except Exception as e:output = inputprint(e)return outputdef is_japanese(s):import unicodedata
app.py+21-15
multit2i.py+57-27
requirements.txt+1-3
tagger/tagger.py+21-21