clementrof commited on
Commit
67b8f97
β€’
1 Parent(s): a117519

Update app3.py

Browse files
Files changed (1) hide show
  1. app3.py +25 -15
app3.py CHANGED
@@ -12,13 +12,13 @@ token = '5UAYO8UWHNQKT3UUS9H8V360L76MD72DRIUY9QC2'
12
 
13
 
14
 
15
- ##############################################################
16
  #################################################
17
 
18
- def SD_call(prompt, image_prompt, age, weight, color, hair_color,hair_length,hair_texture,skin_details,eye_colors,NSFW):
19
 
20
  positive = "clothes"
21
- negative = "naked, nsfw, porn"
22
  serverless_api_id = '7c9nnp0b3ordr8'
23
  # Define the URL you want to send the request to
24
  url = f"https://api.runpod.ai/v2/{serverless_api_id}/runsync"
@@ -30,9 +30,15 @@ def SD_call(prompt, image_prompt, age, weight, color, hair_color,hair_length,hai
30
  "Content-Type": "application/json"
31
  }
32
 
 
 
 
 
 
 
33
  if NSFW == True:
34
- positive = "naked, nsfw"
35
- negative = "clothes"
36
 
37
  if prompt.strip():
38
  total_prompt = prompt
@@ -40,7 +46,7 @@ def SD_call(prompt, image_prompt, age, weight, color, hair_color,hair_length,hai
40
  else:
41
  color = ", ".join(color)
42
  skin_details = ", ".join(skin_details)
43
- total_prompt = f"masterpiece, best quality, 8k, (looking at viewer:1.1), gorgeous, hot, seductive, {age} years old american {color} woman, {weight} woman, (eye contact:1.1), beautiful face, hyper detailed, best quality, ultra high res, {hair_length} {hair_color} {hair_texture} hair,{eye_colors} eyes, {skin_details} photorealistic, high resolution, detailed, raw photo, 1girl,{image_prompt}, amateur cellphone photography. f8.0, samsung galaxy, noise, jpeg artefacts, poor lighting, low light, underexposed, high contrast "
44
 
45
 
46
  # Define your data (this could also be a JSON payload)
@@ -77,11 +83,11 @@ def SD_call(prompt, image_prompt, age, weight, color, hair_color,hair_length,hai
77
  data = {
78
  "input": {
79
  "prompt": f"{total_prompt}, {positive}",
80
- "negative_prompt": f"EasyNegative, fat, paintings, sketches, lowres, ((monochrome)), ((grayscale)), bad anatomy, text, error, cropped, signature, watermark, username, blurry, bad feet, poorly drawn face, bad proportions, gross proportions, ng_deepnegative_v1_75t, badhandsv5-neg, {negative}",
81
  "width": 512,
82
  "height": 720,
83
  "guidance_scale": 7.5,
84
- "num_inference_steps": 50,
85
  "num_outputs": 1,
86
  "prompt_strength": 0.8,
87
  "scheduler": "K-LMS"
@@ -138,13 +144,12 @@ def SD_call(prompt, image_prompt, age, weight, color, hair_color,hair_length,hai
138
 
139
 
140
 
141
- def greet(prompt, image_prompt, age, weight, color, hair_color,hair_length,hair_texture,skin_details,eye_colors,NSFW):
142
- image_path = SD_call(prompt, image_prompt, age, weight, color, hair_color,hair_length,hair_texture,skin_details,eye_colors,NSFW)
143
- #return "Image generated successfully", image_path
144
  if image_path is not None:
145
- return "Image generated successfully", image_path
146
  else:
147
- return "No images found in the response.", None
148
 
149
 
150
  demo = gr.Interface(
@@ -154,16 +159,21 @@ demo = gr.Interface(
154
  gr.Textbox(label="Girl_prompt", lines=3),
155
  gr.Slider(label="Age", value=22, minimum=18, maximum=75),
156
  gr.Radio(["skinny", "slim", "athletic", "muscular", "average", "curvy", "chubby", "overweight", "obese"],label="Body Type",type="value"),
 
157
  gr.CheckboxGroup(choices=["asian", "white", "black", "latina", "middle eastern","indigenous", "Mixed"],label="Color",type="value"),
158
  gr.Radio(["black", "brown", "brunette", "dark brown", "light brown", "blonde", "dirty blonde", "platinum blonde", "red", "auburn", "ginger", "strawberry blonde", "gray", "silver", "white", "blue", "green", "purple", "pink", "rainbow", "multicolored"],label="Hair Color",type="value"),
 
159
  gr.Radio(["short", "long", "mi-long"],label="Hair length", type="value"),
 
160
  gr.Radio(["straight", "curvy", "wavy"],label="Hair texture", type="value"),
 
161
  gr.CheckboxGroup(choices=["((tattoos))", "((birthmark))", "freckles", "((scars))"],label="Skin details", type="value"),
162
- gr.Radio(["brown", "hazel", "green", "blue", "gray", "amber", "black", "red", "violet"],label="Eye Color", type="value"),
 
163
  gr.Checkbox(label="NSFW", info="πŸ‘€πŸ‘€πŸ‘€")
164
  ],
165
  flagging_options=["blurry", "incorrect", "other"],
166
- outputs=[gr.Textbox(label="Answer", lines=3), gr.Image(label="Generated Image", type="filepath")],
167
  )
168
 
169
  demo.launch(share=True)
 
12
 
13
 
14
 
15
+ #############################################################
16
  #################################################
17
 
18
+ def SD_call(prompt, image_prompt, age, weight, w_w, color, hair_color,h_c_w, hair_length, h_l_w,hair_texture, h_t_w,skin_details, eye_colors, e_c_w,NSFW):
19
 
20
  positive = "clothes"
21
+ negative = "(((naked))), (((nsfw))), porn"
22
  serverless_api_id = '7c9nnp0b3ordr8'
23
  # Define the URL you want to send the request to
24
  url = f"https://api.runpod.ai/v2/{serverless_api_id}/runsync"
 
30
  "Content-Type": "application/json"
31
  }
32
 
33
+ weight = f"{'(' * w_w}{weight} woman{')' * w_w}"
34
+ hair_color=f"{'(' * h_c_w}{hair_color} hair{')' * h_c_w}"
35
+ hair_length=f"{'(' * h_l_w}{hair_length} hair{')' * h_l_w}"
36
+ hair_texture =f"{'(' * h_t_w}{hair_texture} hair{')' * h_t_w}"
37
+ eye_colors=f"{'(' * e_c_w}{eye_colors} eyes{')' * e_c_w}"
38
+
39
  if NSFW == True:
40
+ positive = "((naked)), ((nsfw))"
41
+ negative = "((clothes))"
42
 
43
  if prompt.strip():
44
  total_prompt = prompt
 
46
  else:
47
  color = ", ".join(color)
48
  skin_details = ", ".join(skin_details)
49
+ total_prompt = f"masterpiece, best quality, 8k, (looking at viewer:1.1), gorgeous, hot, seductive, {age} years old american {color} woman, {weight}, (eye contact:1.1), beautiful face, hyper detailed, best quality, ultra high res, {hair_length}, {hair_color}, {hair_texture},{eye_colors}, {skin_details}, photorealistic, high resolution, detailed, raw photo, 1girl,{image_prompt}, amateur cellphone photography. f8.0, samsung galaxy, noise, jpeg artefacts, poor lighting, low light, underexposed, high contrast "
50
 
51
 
52
  # Define your data (this could also be a JSON payload)
 
83
  data = {
84
  "input": {
85
  "prompt": f"{total_prompt}, {positive}",
86
+ "negative_prompt": f"paintings, sketches, lowres, ((monochrome)), ((grayscale)), bad anatomy, text, error, cropped, signature, watermark, username, blurry, bad feet, poorly drawn face, bad proportions, gross proportions, badhandsv5-neg, {negative}",
87
  "width": 512,
88
  "height": 720,
89
  "guidance_scale": 7.5,
90
+ "num_inference_steps": 30,
91
  "num_outputs": 1,
92
  "prompt_strength": 0.8,
93
  "scheduler": "K-LMS"
 
144
 
145
 
146
 
147
+ def greet(prompt, image_prompt, age, weight, w_w, color, hair_color, h_c_w, hair_length, h_l_w,hair_texture, h_t_w,skin_details, eye_colors, e_c_w,NSFW):
148
+ image_path = SD_call(prompt, image_prompt, age, weight, w_w, color, hair_color,h_c_w, hair_length, h_l_w,hair_texture, h_t_w,skin_details, eye_colors, e_c_w,NSFW)
 
149
  if image_path is not None:
150
+ return image_path
151
  else:
152
+ return None
153
 
154
 
155
  demo = gr.Interface(
 
159
  gr.Textbox(label="Girl_prompt", lines=3),
160
  gr.Slider(label="Age", value=22, minimum=18, maximum=75),
161
  gr.Radio(["skinny", "slim", "athletic", "muscular", "average", "curvy", "chubby", "overweight", "obese"],label="Body Type",type="value"),
162
+ gr.Slider(label="Body Type weight", value=2, minimum=1, maximum=4, step=1),
163
  gr.CheckboxGroup(choices=["asian", "white", "black", "latina", "middle eastern","indigenous", "Mixed"],label="Color",type="value"),
164
  gr.Radio(["black", "brown", "brunette", "dark brown", "light brown", "blonde", "dirty blonde", "platinum blonde", "red", "auburn", "ginger", "strawberry blonde", "gray", "silver", "white", "blue", "green", "purple", "pink", "rainbow", "multicolored"],label="Hair Color",type="value"),
165
+ gr.Slider(label="Hair Color weight", value=2, minimum=1, maximum=4, step=1),
166
  gr.Radio(["short", "long", "mi-long"],label="Hair length", type="value"),
167
+ gr.Slider(label="Hair length weight", value=2, minimum=1, maximum=4, step=1),
168
  gr.Radio(["straight", "curvy", "wavy"],label="Hair texture", type="value"),
169
+ gr.Slider(label="Hair texture weight", value=2, minimum=1, maximum=4, step=1),
170
  gr.CheckboxGroup(choices=["((tattoos))", "((birthmark))", "freckles", "((scars))"],label="Skin details", type="value"),
171
+ gr.Radio(["brown", "hazel", "green", "blue", "gray", "amber", "black", "red", "violet"],label="Eyes Color", type="value"),
172
+ gr.Slider(label="Eyes color weight", value=2, minimum=1, maximum=4, step=1),
173
  gr.Checkbox(label="NSFW", info="πŸ‘€πŸ‘€πŸ‘€")
174
  ],
175
  flagging_options=["blurry", "incorrect", "other"],
176
+ outputs=[gr.Image(label="Generated Image", type="filepath")],
177
  )
178
 
179
  demo.launch(share=True)