This commit is contained in:
billwuhao
2025-01-07 18:35:24 +08:00
parent 53f4c29b51
commit f520fbef5a
15 changed files with 783 additions and 2 deletions
+21
View File
@@ -0,0 +1,21 @@
name: Publish to Comfy registry
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "pyproject.toml"
jobs:
publish-node:
name: Publish Custom Node to registry
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Publish Custom Node
uses: Comfy-Org/publish-node-action@main
with:
## Add your own personal access token to your Github Repository secrets and reference it here.
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
+5
View File
@@ -1,3 +1,8 @@
txtfiles/humans.txt
txtfiles/others.txt
txtfiles/human_poses.txt
txtfiles/styles.txt
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
+107 -2
View File
@@ -1,2 +1,107 @@
# ComfyUI_OneButtonPrompt_Flux
One Button Prompt for Flux in ComfyUI
![One Button Prompt for Flux in ComfyUI](https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux/blob/main/images/example.png)
---
# One Button Prompt for Flux in ComfyUI
## Summary
This is a node for generating Flux prompts with one click in ComfyUI.
## Usage
- **If "human" is selected**, it will generate only the human-related prompt.
- **If "other" is selected**, it will generate only the other-related prompt.
- **If "dual_subject" is selected**, it will include both of the above.
- **If "human_pose" is enabled**, it will generate a human pose prompt.
- **If "style" is enabled**, it will generate a style prompt.
- **Lora trigger words/prefixes** are optional and can be customized.
- If you have modified the custom file during the generation images, please enable **refresh** to update it, without having to restart the software
- **If the seed is fixed**, it will generate the same fixed prompt.
![alt text](https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux/blob/main/images/image-1.png)
**Example Prompt**:
(MW:1.2), a beautiful girl, fall asleep, A beautiful lovely alpaca, naive art
- `(MW:1.2)` is the **Lora trigger word**.
- `a beautiful girl` is the **human**.
- `fall asleep` is the **human_pose**.
- `A beautiful lovely alpaca` is the **other**.
- `naive art` is the **style**.
## Custom Subjects, Poses, and Styles
1. Create four files under the folder `ComfyUI\custom_nodes\ComfyUI_OneButtonPrompt_Flux\txtfiles`.
![alt text](https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux/blob/main/images/image.png)
2. Input the corresponding content into each file to generate your custom subject, pose, and style.
3. The `prompt_words.xlsx` file contains prompts I gathered a long time ago when experimenting with **Disco Diffusion** and **SD 1.5**. You can refer to it for ideas.
**Note**: Be sure to create new files and modify them freely; this will not affect the node's functionality or future updates.
## Automatic Image Generation
If you want to automatically generate images while your computer is running, select `Queue (On Change)` and click Start. Workflow in `workflow_example`.
![alt text](https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux/blob/main/images/image-2.png)
## Using with Prompt Enhancer
ComfyUI-Fluxpromptenhancer: https://github.com/marduk191/ComfyUI-Fluxpromptenhancer
---
## 概述
这是一个在 comfyui 中一键生成 flux 提示的节点.
## 用法
- 主体选择 human,则只生成 human 提示
- 选择 other,则只生成 other 提示
- 选择 dual_subject,则包含上述两者
- 如果开启 human_pose,将生成人物姿态提示
- 如果开启 style,将生成 style 提示
- lora 触发词/前缀 是可选的,可自定义输入
- 如果你在运行过程中修改了自定义文件, 请开启 refresh 刷新一下, 而不用重启软件.
- 如果固定种子,将只生成一次固定的提示
![alt text](https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux/blob/main/images/image-1.png)
(MW:1.2), a beautiful girl, fall asleep, A beautiful lovely alpaca, naive art
- `(MW:1.2)`, 是 lora 触发词
- `a beautiful girl`, 是 human
- `fall asleep`, 是 human_pose
- `A beautiful lovely alpaca`, 是 other
- `naive art`, 是 style
## 自定义主体,姿态和风格
1. 在文件夹 `ComfyUI\custom_nodes\ComfyUI_OneButtonPrompt_Flux\txtfiles` 下面新建 4 个文件
![alt text](https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux/blob/main/images/image.png)
2. 分别输入相应的内容, 即可生成自定义的主体, 姿态, 风格
3. `prompt_words.xlsx` 文件里是我很早的时候, 玩 disco diffusion 和 sd1.5 时整理的提示, 你可以参考.
注意: 一定要新建文件, 然后随意修改, 并不会影响节点使用和更新.
## 自动生图
如果你想挂着电脑自动生图, 选择 `Queue (On Change)` 点击开始即可. 工作流在 `workflow_example` 里.
![alt text](https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux/blob/main/images/image-2.png)
## 结合 Prompt Enhancer 一起使用
ComfyUI-Fluxpromptenhancer: https://github.com/marduk191/ComfyUI-Fluxpromptenhancer
# Thank you
Thank you to the amazing [OneButtonPrompt](https://github.com/AIrjen/OneButtonPrompt) for inspiration.
+113
View File
@@ -0,0 +1,113 @@
import random
import os
def process_txt_file(txtfile: str):
script_dir = os.path.dirname(os.path.abspath(__file__)) # Script directory
file_path = os.path.join(script_dir, "./txtfiles/", txtfile)
if not os.path.exists(file_path):
file_path = os.path.join(script_dir, "./txtfiles/", "example_" + txtfile)
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
processed_lines = [line.strip() for line in lines if line.strip()]
return processed_lines
humans = process_txt_file("humans.txt")
others = process_txt_file("others.txt")
human_poses = process_txt_file("human_poses.txt")
styles = process_txt_file("styles.txt")
subject = ["human", "other", "dual_subject"]
def generate_prompt(subject: str, human_pose: bool, style: bool, lora_trigger_or_prefix: str, refresh: bool, seed: int):
if refresh:
global humans, others, human_poses, styles
humans = process_txt_file("humans.txt")
others = process_txt_file("others.txt")
human_poses = process_txt_file("human_poses.txt")
styles = process_txt_file("styles.txt")
if seed > 0:
random.seed(seed)
prompt_human = random.choice(humans)
prompt_other = random.choice(others)
prompt_human_pose = random.choice(human_poses)
prompt_style = random.choice(styles)
if subject == "human":
prompt_subject = random.choice(humans)
if human_pose == True:
prompt_subject = prompt_subject + ", " + prompt_human_pose
if subject == "other":
prompt_subject = prompt_other
if subject == "dual_subject":
if human_pose == True:
prompt_subject = prompt_human + ", " + prompt_human_pose + ", " + prompt_other
else:
prompt_subject = prompt_human + ", " + prompt_other
if lora_trigger_or_prefix:
if lora_trigger_or_prefix.strip():
lora_trigger_or_prefix = lora_trigger_or_prefix.strip() + ", "
if style == True:
prompt = lora_trigger_or_prefix + prompt_subject + ", " + prompt_style
else:
prompt = lora_trigger_or_prefix + prompt_subject
return prompt
class OneButtonPromptFlux:
CATEGORY = "MW-OneButtonPrompt"
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("prompt",)
FUNCTION = "fluxprompt"
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"subject": (subject, {
"default": "human", "tooltip": "'dual_subject' including both"
}),
},
"optional": {
"human_pose": ("BOOLEAN", {"default": False, "tooltip": "Effective when selecting 'human'"}),
"style": ("BOOLEAN", {"default": True}),
"lora_trigger_or_prefix": ("STRING", {
"multiline": False,
"default": "", "tooltip": "Lora trigger words or custom prefix."
}),
"refresh": ("BOOLEAN", {"default": False}),
"seed": ("INT", {"default": 0, "min": 0, "max": 0xFFFFFFFFFFFFFFFF}),
},
}
def fluxprompt(
self,
subject: str = "human",
human_pose: bool = False,
style: bool = True,
lora_trigger_or_prefix: str = "",
refresh: bool = False,
seed: int = 0):
return (generate_prompt(subject, human_pose, style, lora_trigger_or_prefix, refresh, seed),)
NODE_CLASS_MAPPINGS = {
"OneButtonPromptFlux": OneButtonPromptFlux,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"OneButtonPromptFlux": "One Button Prompt Flux",
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

+14
View File
@@ -0,0 +1,14 @@
[project]
name = "ComfyUI_OneButtonPrompt_Flux"
description = "ComfyUI_OneButtonPrompt_Flux is a Flux prompt generation node. The subject can be "human," "other" or a combination of both. For human, pose settings can be enabled. Additionally, various styles can be applied. Finally, combine it with "Prompt Enhancement" to seamlessly automate image generation, eliminating the hassle of designing prompts."
version = "1.0.0"
license = { file = "LICENSE" }
[project.urls]
Repository = "https://github.com/billwuhao/ComfyUI_OneButtonPrompt_Flux"
# Used by Comfy Registry https://comfyregistry.org
[tool.comfy]
PublisherId = "MW"
DisplayName = "ComfyUI_OneButtonPrompt_Flux"
Icon = ""
+63
View File
@@ -0,0 +1,63 @@
on horseback
read a book
fall asleep
lie in bed
Holding a samurai sword
Holding the Swordsman Sword
have a meal
Make a heart-shaped gesture
Make a V gesture
military salute
run
cry
Giving a thumbs up
Flipping the middle finger
Posing like a cat
Aiming with a finger gun
Putting a finger to lips, shushing
Holding something in hands
Waving hand
Saluting with a raised hand
Stretching arms upwards
Raising both arms in the air
Spreading arms wide
Hand placed on mouth
Pulling hair
Showing armpits
Performing a curtsy
Smiling with fingers
Resting chin on hand
Supporting body with arm
Keeping arms behind back
Crossing arms in front of body
Placing hand on hip
Hands resting on hips
Adjusting thigh-high stockings
Dancing the "Caramelldansen"
Holding hands with someone
Crossing legs while sitting
Lying in a fetal position
Lifting one leg
Lying on back with legs up
Spreading legs apart
Carrying someone like a princess
Taking a fighting stance
Upside-down, head down
Looking back over shoulder
Lying on stomach
Squatting down
Straddling
Kneeling on both knees
Bending over
On all fours (hands and knees)
Arched back while standing
Sitting upright
Sitting in seiza (Japanese kneeling position)
Sitting in wariza (legs splayed to the sides)
Sitting sideways with legs to one side
Sitting in Indian style (cross-legged)
Hugging one's own legs
Leaning forward
Hugging someone
Lying on lap (lap pillow position)
Standing with relaxed posture
+65
View File
@@ -0,0 +1,65 @@
A handsome soldier in uniform
A stern policeman on duty
A fatherly man with a gentle smile
A beautiful, ethereal fairy
A mystical mermaid with flowing hair
A beautiful woman in police uniform
A metallic, robotic girl with glowing features
A caring, motherly girl
A strong, masculine man
A chivalrous man offering a helping hand
A dapper, well-dressed man
A handsome man with a confident posture
A muscular, macho man
A regal royal woman in elegant attire
A stunning beach woman in a bikini
A beautiful Chinese classical woman in traditional dress
A graceful Imperial Concubine in royal attire
A beautiful Khātam girl with traditional features
A brave grenadier in military uniform
A quintessential technocrat with a serious demeanor
A short, dwarfish warrior in armor
An elfin girl with pointed ears and mystical aura
A cybernetic female robot with futuristic design
A regal emperor in royal portrait style
A queen in a majestic gown
A skilled swordsman with a sharp blade
A fierce warrior ready for battle
A beautiful angel with delicate wings
A wise, white Gandalf-like wizard
A beautiful girl in a flowing Hanfu dress
A silhouette of a woman at dusk
A man with a cat's head, exotic and mysterious
A male adult film star with confident charm
A strong, penetrating man with intense eyes
A perky, energetic man with a broad smile
A tough guy with a rugged look
A scruffy man with a disheveled appearance
A teenage boy, handsome and fresh-faced
A young virgin with innocent eyes
A muscular, handsome man with defined features
A stylish male model striking a pose
A beautiful woman with a cat's head, mystical charm
A beautiful actress with a captivating smile
A graceful female model in fashion pose
A beautiful, sensual nurse in a healing pose
A seductive female student with a curious expression
A beautiful Medusa with mesmerizing eyes
A playful, frisky girl with a mischievous smile
A wise Elven king with a crown of leaves
A beautiful, youthful loli with innocence
A beautiful traditional woman in classic attire
A beautiful oriental woman with exotic features
A powerful magic patriarch with ancient wisdom
A demon world chief with fiery eyes
A mighty orc chief with fierce strength
A spectral figure in ghostly attire
A zombie rising from the grave
A skeletal figure with hollow eyes
A dragonborn warlock with mystical powers
A cyberpunk ape with high-tech enhancements
A vampire with sharp fangs and glowing eyes
A wizard casting a spell in the dark
A devil with fiery horns and red skin
A fierce female orc with battle scars
A death god with a dark aura
+154
View File
@@ -0,0 +1,154 @@
Cthulhu
Convertible
Coupe
Dragster
Hatchback
Hearse
Hotrod
Humvee
Jeep
Van
Motorcycle
Tank
Hedgehog
Hippopotamus
Fierce Leopard
Elephant
Affenpinscher
Beautiful Crane
Heron
Arctic Fox
Fennec Fox
Fire Wolf
Chibi Dragon
Dragon
Deer with beautiful horns
Deer
Camel
Majestic Horse
Herd of Horses
Zebra
Mighty Bull Demon King
Mighty Bull with long horns
Beautiful Antarctic Cyber Penguin
Mighty Lion
Fierce Lion close-up
Fierce Bear
Beautiful and Lovely Bear
Charming Panda
Beautiful Swan
Cyber Swan
Long-Horned Ram
Lovely Alpaca
Parrotlet
Spix's Macaw
Bearded Vulture
Cinereous Vulture
Marble Caves in Chile
Benagil Sea Cave, Portugal
Reed Flute Cave, China
Crystal Caves, Iceland
Frasassi Caves, Italy
Antarctica Landscape
Avenue of the Baobabs
Most Beautiful Bay in the World
Most Beautiful Bayou
Mount Ararat
Mount Blanc
Mount Everest
Mount Fuji
Mount Kenya
Seascape
Serengeti National Park
Sloping Meadows
The Dark Hedges
Grand Canyon
Lofoten Islands
Torres del Paine National Park
Victoria Falls
Wadi Rum
Beautiful Waterfalls
Waterside City
Wetland Landscape
Wulingyuan Scenic Area
Yulong Xueshan
Ship and Huge Storm on the Sea
Cactus Kingdom
Mountainous Landscape
Giant Ships and Storms
Beautiful Ornate Landscape
Placid Lakescape
Precipitous Waterfalls
Heavenly Capital
Precipitous Cliff with River
Precipitous Cliff and Colossal Statues
Magic Dense Primordial Forest
Regal Ancient Palace in Heaven
Regal Ancient Palace in Clouds
Rustic Floral House in Clouds
Spooky Secluded Magic Landscape
Spectacular Dreamlike Ships in Space
Staggering Wonder Landscape
Sublime Beauty of Nature
Supernatural Landscape at Night
Aliens Invading Fantasy Landscape
Reclusive Fantasy Landscape
Angkor Wat
Burj Khalifa
Colosseum
Eiffel Tower
Empire State Building
Hagia Sophia
La Sagrada Familia
Lotus Temple
Namcha Barwa Architecture
Notre Dame Cathedral
Parliament Building
Parthenon
Pavilion
Petra Historical City
Saint Basil’s Cathedral
Sydney Opera House
Taj Mahal
Heydar Aliyev Center
Palace of Westminster
Dreamlike Seaside Tower at Moonlight
Domed Building
Pagoda
Portal to Heaven
Art Deco City
Infinite Hallway
Shining Hotel Lobby
Scientific Base
Giant Skyscraper
Predjama Castle, Slovenia
Majlis al Jinn, Oman
Ajanta Caves, India
Legislative Edifice
Magnificent Building
Narrow Corridor to Hell
Narrow Corridor to Heaven
Opulent Apartment
Opulent Detached Houses
Opulent Throne Room
Palatial Chamber
Palatial Office Building
Palatial House with Lights at Night
Quintessential Symbol of a City
Spooky Sacrificial Building
Soaring Magic Building in Cloud
Soaring Building
Spiraled Science Fiction Building
Magic Subterranean Research Station
Towering Ancient Temples in Rosy Clouds
Towering Sci-Fi Space Station in Universe
Beautiful Modern Architecture in Clouds
Beautiful Ancient Architecture in China at Dusk
Cyberpunk Bustling Downtown
Intricate Deconstructivism Architecture
Fractalism Building
Beautiful Architectural Painting
Art Deco Palace Lobby
Art Nouveau Gorgeous Architecture Interior
Baroque Gorgeous Architecture Interior
Martial Arts Silhouette at Dusk
+240
View File
@@ -0,0 +1,240 @@
Digital 3D Sculpting
Diorama
Mythpunk
Kinetic Art
Junk Art
3D Game Shader
3D Ambient Occlusion
3D Pre-rendered Graphics
Voxel Art
Arte Povera
Carved Lacquer Art
Wood Intarsia Art
Steel Engraving
Wood Engraving
Carving Art
Relief Art
Digital Art
Vector Art
Acrylic Painting
Charcoal Drawing
Colored Pencil Drawing
Encaustic Painting
Fresco Painting
Gouache
Ink Wash Painting
Matte Painting
Oil Painting
Pastel Drawing
Pencil Drawing
Silverpoint Drawing
Tempera Painting
Velvet Painting
Watercolor Painting
Marouflage Painting
Mural Art
Stippling
Hudson River School Painting
Naturalism Painting
Allegorical
Romanticism
Ashcan School
Barbizon School Painting
Chalk Drawing
Chinese Painting
Crayon Drawing
Dutch Golden Age
French Renaissance
German Renaissance
High Renaissance
Impressionism
Ink Drawing
Mannerism
Neo-Impressionism
Orientalism
Panel Painting
Pointillism
Post-Impressionism
Pre-Raphaelites
Realism Painting
Social Realism Painting
Still Life
Synthetism
Tonalism
Mixed Media Painting
Amsterdam Impressionism
Landscape Painting
Fantastic Realism
Magic Realism
Flemish Baroque
Rococo
Figurative Art
Neoclassicism Art
Nihonga Painting
Fantasy Art
Adventure Pulp Poster
Flat Color Picture
Graphic Novel
Propaganda Poster
Storybook Illustration
Comic Strip
Caravaggisti
Edo Period Painting
Hyperrealism Art
Photorealism
Anime
Manga
Infrared Art
Mexican Muralism
HD Photo
National Geographic Photo
Stage Photo
Film Still
Autochrome
French New Wave
Redscale
Pixel Art
Needlepoint Art
Mosaic Art
Stained Glass Art
Cross-Stitch Art
Embroidery Art
Intarsia Art
Fiber Art
Indienne Textile Art
Tapestry Art
Chinoiserie Art
Naive Art
X-ray Photography
Line Art
Isometric Art
Low Poly
Art Brut
Chillwave Art
Graffiti Art
Maximalism
Phantasm Art
Illusionism Art
Aestheticism Art
Avant-Garde Art
Fractalism
LSD Art
Psychedelic Punk
Chinese Paper Cutting
Kirie Paper Art
Massurrealism
Surrealism
Botanical Illustration
Marine Art
Spray Paint Art
Primitivism Painting
Icon Religious Painting
Master Print Art
Flower Bouquet Art
Sōsaku-Hanga
Clockpunk
Dieselpunk
Mechanical Punk
Steampunk
Steelpunk
Baroque
Brutalism Art
Modernism Art
Romanesque
Trompe-l'œil Painting
Afrofuturism
Cyberpunk
Futuresynth Art
Post-Cyberpunk
Sci-Fi
Solarpunk
Tech Noir
Synthwave Art
Cartoon
Chibi
Children’s Illustration
Lowbrow Art
Fractal Manifold
Solarised Art
Spatialism Art
Vaporwave
Computer-Generated Hologram
Caricature
Character Design
Peking Opera Art
Pin-Up
Pop Art
Thangka Art
Fauvism
Gothic
Collage
Silhouette
Geometric Art
Illuminated Manuscript
Indian Ink Painting
Minimalism
Op Art
Screenprint Art
Anaglyph Effect Art
Japonisme Art
Arabesque Patterns Art
Acidwave Art
Cyberart
Optical Illusion Art
Y2K Aesthetic Art
Manichaean Art
Shin-Hanga Painting
Ukiyo-e Painting
2D Game
Retrowave Art
Aquatint Art
Etching Art
Linocut Art
Woodblock
Popular Print Art
Lithography Painting
Engraving
Concept Art
Dark Academia Art
Fashion Art
Feminist Art
Melanin Art
Movie Poster
Nirvana Art
Street Art
Thunderpunk
Kawaii
Pop Surrealism
Cybernetic Art
Daydream Punk Art
Acidpunk Art
Aetherpunk Art
Funk Art
Decopunk Art
Kitsch
Art Nouveau
Art Deco
Arts and Crafts Movement
Eastern Art
Electronic Art
Modern Anime Still
DMT Art
Line-Drawing
Ambient Occlusion Art
Cel Shading Art
Double Exposure
Intricate Pattern Details Art
Leave Negative Space
3D Printed Art
Sculpture Art
Statue Art
By Famous Artists (e.g., Alex Grey, Albert Bierstadt)
Expressionism
Figurativism
German Expressionism
Glitch Art
Cyanotype
Futurism
Abstract
Cubism
De Stijl
Binary file not shown.
File diff suppressed because one or more lines are too long