panelforge commited on
Commit
238fe34
·
verified ·
1 Parent(s): 359452f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -4,7 +4,7 @@ import random
4
  import spaces # [uncomment to use ZeroGPU]
5
  from diffusers import DiffusionPipeline, DPMSolverSDEScheduler
6
  import torch
7
- from tags import tag_options_1, tag_options_2, tag_options_3, tag_options_4 # Import tags here
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
  model_repo_id = "John6666/wai-ani-nsfw-ponyxl-v8-sdxl" # Replace to the model you would like to use
@@ -25,11 +25,13 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
25
 
26
  # Determine final prompt
27
  if use_tags:
28
- selected_tags_1 = [tag_options_1[tag] for tag in tag_selection_1 if tag in tag_options_1]
29
- selected_tags_2 = [tag_options_2[tag] for tag in tag_selection_2 if tag in tag_options_2]
30
- selected_tags_3 = [tag_options_3[tag] for tag in tag_selection_3 if tag in tag_options_3]
31
- selected_tags_4 = [tag_options_4[tag] for tag in tag_selection_4 if tag in tag_options_4]
32
  tags_text = ', '.join(selected_tags_1 + selected_tags_2 + selected_tags_3 + selected_tags_4)
 
 
33
  final_prompt = f'score_9, score_8_up, score_7_up, source_anime, {tags_text}'
34
  else:
35
  final_prompt = f'score_9, score_8_up, score_7_up, source_anime, {prompt}'
@@ -100,13 +102,13 @@ with gr.Blocks(css=css) as demo:
100
  with gr.TabItem("Tag Selection"):
101
  # Separate each tag section vertically
102
  with gr.Column():
103
- tag_selection_1 = gr.CheckboxGroup(choices=list(tag_options_1.keys()), label="Select Tags (Style)")
104
  with gr.Column():
105
- tag_selection_2 = gr.CheckboxGroup(choices=list(tag_options_2.keys()), label="Select Tags (Theme)")
106
  with gr.Column():
107
- tag_selection_3 = gr.CheckboxGroup(choices=list(tag_options_3.keys()), label="Select Tags (Other)")
108
  with gr.Column():
109
- tag_selection_4 = gr.CheckboxGroup(choices=list(tag_options_4.keys()), label="Select Tags (Additional)")
110
 
111
  use_tags = gr.State(True)
112
 
 
4
  import spaces # [uncomment to use ZeroGPU]
5
  from diffusers import DiffusionPipeline, DPMSolverSDEScheduler
6
  import torch
7
+ from tags import participant_tags, tribe_tags, skin_tone_tags, body_type_tags, tattoo_tags, piercing_tags, expression_tags, eye_tags, hair_style_tags, position_tags, fetish_tags, location_tags, camera_tags, atmosphere_tags # Import tags here
8
 
9
  device = "cuda" if torch.cuda.is_available() else "cpu"
10
  model_repo_id = "John6666/wai-ani-nsfw-ponyxl-v8-sdxl" # Replace to the model you would like to use
 
25
 
26
  # Determine final prompt
27
  if use_tags:
28
+ participant_tags = [participant_tags[tag] for tag in participant_tags if tag in participant_tags]
29
+ tribe_tags = [tribe_tags[tag] for tag in tribe_tags if tag in tribe_tags]
30
+ skin_tone_tags = [skin_tone_tags[tag] for tag in skin_tone_tags if tag in skin_tone_tags]
31
+ body_type_tags = [body_type_tags[tag] for tag in body_type_tags if tag in body_type_tags]
32
  tags_text = ', '.join(selected_tags_1 + selected_tags_2 + selected_tags_3 + selected_tags_4)
33
+
34
+
35
  final_prompt = f'score_9, score_8_up, score_7_up, source_anime, {tags_text}'
36
  else:
37
  final_prompt = f'score_9, score_8_up, score_7_up, source_anime, {prompt}'
 
102
  with gr.TabItem("Tag Selection"):
103
  # Separate each tag section vertically
104
  with gr.Column():
105
+ participant_tags = gr.CheckboxGroup(choices=list(participant_tags.keys()), label="Select Tags (Style)")
106
  with gr.Column():
107
+ tribe_tags = gr.CheckboxGroup(choices=list(tribe_tags.keys()), label="Select Tags (Theme)")
108
  with gr.Column():
109
+ skin_tone_tags = gr.CheckboxGroup(choices=list(skin_tone_tags.keys()), label="Select Tags (Other)")
110
  with gr.Column():
111
+ body_type_tags = gr.CheckboxGroup(choices=list(body_type_tags.keys()), label="Select Tags (Additional)")
112
 
113
  use_tags = gr.State(True)
114