import gradio as gr from dartrs.v2 import AspectRatioTag, LengthTag, RatingTag, IdentityTag # from https://huggingface.co/spaces/cagliostrolab/animagine-xl-3.1/blob/main/config.py QUALITY_TAGS = { "default": "(masterpiece), best quality, very aesthetic, perfect face", } NEGATIVE_PROMPT = { "default": "nsfw, (low quality, worst quality:1.2), very displeasing, 3d, watermark, signature, ugly, poorly drawn", } IMAGE_SIZE_OPTIONS = { "1536x640": "<|aspect_ratio:ultra_wide|>", "1344x768": "<|aspect_ratio:wide|>", "1024x1024": "<|aspect_ratio:square|>", "768x1344": "<|aspect_ratio:tall|>", "640x1536": "<|aspect_ratio:ultra_tall|>", } IMAGE_SIZES = { "1536x640": (1536, 640), "1344x768": (1344, 768), "1024x1024": (1024, 1024), "768x1344": (768, 1344), "640x1536": (640, 1536), } ASPECT_RATIO_OPTIONS: list[AspectRatioTag] = [ "ultra_wide", "wide", "square", "tall", "ultra_tall", ] RATING_OPTIONS: list[RatingTag] = [ "sfw", "general", "sensitive", "nsfw", "questionable", "explicit", ] LENGTH_OPTIONS: list[LengthTag] = [ "very_short", "short", "medium", "long", "very_long", ] IDENTITY_OPTIONS: list[IdentityTag] = [ "none", "lax", "strict", ] PEOPLE_TAGS = [ *[f"1{x}" for x in ["girl", "boy", "other"]], *[f"{i}girls" for i in range(2, 6)], *[f"6+{x}s" for x in ["girl", "boy", "other"]], "no humans", ] # ref: https://qiita.com/tregu148/items/fccccbbc47d966dd2fc2 def gradio_copy_text(_text: None): gr.Info("Copied!") COPY_ACTION_JS = """\ (inputs, _outputs) => { // inputs is the string value of the input_text if (inputs.trim() !== "") { navigator.clipboard.writeText(inputs); } }"""