clementrof commited on
Commit
953f4c0
β€’
1 Parent(s): e72ed18

Update app3.py

Browse files
Files changed (1) hide show
  1. app3.py +13 -6
app3.py CHANGED
@@ -15,8 +15,11 @@ token = '5UAYO8UWHNQKT3UUS9H8V360L76MD72DRIUY9QC2'
15
  ##############################################################
16
  #################################################
17
 
18
- def SD_call(image_prompt, age, color, hair_color):
19
 
 
 
 
20
  serverless_api_id = '3g77weiulabzuk'
21
  # Define the URL you want to send the request to
22
  url = f"https://api.runpod.ai/v2/{serverless_api_id}/runsync"
@@ -30,6 +33,9 @@ def SD_call(image_prompt, age, color, hair_color):
30
 
31
  # Define your data (this could also be a JSON payload)
32
  print("SD_processing")
 
 
 
33
  data = {
34
  "input": {
35
  "api": {
@@ -44,8 +50,8 @@ def SD_call(image_prompt, age, color, hair_color):
44
  "override_settings_restore_afterwards": True,
45
  "refiner_checkpoint": "",
46
  "refiner_switch_at": 0.8,
47
- "prompt": f"masterpiece, best quality, 8k, (looking at viewer:1.1), gorgeous, hot, seductive, {age} years old american {color} woman, (eye contact:1.1), beautiful face, hyper detailed, best quality, ultra high res, {hair_color} hair,blue eyes, photorealistic, high resolution, detailed, raw photo, 1girl,{image_prompt} ",
48
- "negative_prompt": "EasyNegative, fat, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), bad anatomy, text, error, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet, poorly drawn face, bad proportions, gross proportions, ng_deepnegative_v1_75t, badhandsv5-neg, clothes",
49
  "seed": -1,
50
  "batch_size": 1,
51
  "steps": 30,
@@ -197,9 +203,9 @@ def Chat_call(chat,temperature):
197
 
198
 
199
 
200
- def greet(chat, image_prompt, temperature, age, color, hair_color):
201
  if image_prompt.strip():
202
- image_path = SD_call(image_prompt,age, color, hair_color)
203
  return "Image generated successfully", image_path
204
 
205
  if temperature > 3:
@@ -216,7 +222,8 @@ demo = gr.Interface(
216
  gr.Slider(label="Text temperature", value=1, minimum=0, maximum=2),
217
  gr.Slider(label="Age", value=22, minimum=18, maximum=75),
218
  gr.Dropdown(["asian", "white", "black", "latina"], label="Color", info="Will add more later!"),
219
- gr.Dropdown(["blond", "brune", "red", "white", "pink", "black", "blue", "green"], label="Hair color", info="Blond is cool")
 
220
  ],
221
  flagging_options=["blurry", "incorrect", "other"],
222
  outputs=[gr.Textbox(label="Answer", lines=3), gr.Image(label="Generated Image", type="filepath")],
 
15
  ##############################################################
16
  #################################################
17
 
18
+ def SD_call(image_prompt, age, color, hair_color,NSFW):
19
 
20
+
21
+ postive = "clothes"
22
+ negative = "naked, nsfw, porn"
23
  serverless_api_id = '3g77weiulabzuk'
24
  # Define the URL you want to send the request to
25
  url = f"https://api.runpod.ai/v2/{serverless_api_id}/runsync"
 
33
 
34
  # Define your data (this could also be a JSON payload)
35
  print("SD_processing")
36
+ if NSFW:
37
+ postive = "naked, nsfw"
38
+ negative = "clothes"
39
  data = {
40
  "input": {
41
  "api": {
 
50
  "override_settings_restore_afterwards": True,
51
  "refiner_checkpoint": "",
52
  "refiner_switch_at": 0.8,
53
+ "prompt": f"masterpiece, best quality, 8k, (looking at viewer:1.1), gorgeous, hot, seductive, {age} years old american {color} woman, (eye contact:1.1), beautiful face, hyper detailed, best quality, ultra high res, {hair_color} hair,blue eyes, photorealistic, high resolution, detailed, raw photo, 1girl,{image_prompt}, {positive} ",
54
+ "negative_prompt": f"EasyNegative, fat, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), bad anatomy, text, error, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, bad feet, poorly drawn face, bad proportions, gross proportions, ng_deepnegative_v1_75t, badhandsv5-neg, {negative}",
55
  "seed": -1,
56
  "batch_size": 1,
57
  "steps": 30,
 
203
 
204
 
205
 
206
+ def greet(chat, image_prompt, temperature, age, color, hair_color,NSFW):
207
  if image_prompt.strip():
208
+ image_path = SD_call(image_prompt,age, color, hair_color,NSFW)
209
  return "Image generated successfully", image_path
210
 
211
  if temperature > 3:
 
222
  gr.Slider(label="Text temperature", value=1, minimum=0, maximum=2),
223
  gr.Slider(label="Age", value=22, minimum=18, maximum=75),
224
  gr.Dropdown(["asian", "white", "black", "latina"], label="Color", info="Will add more later!"),
225
+ gr.Dropdown(["blond", "brune", "red", "white", "pink", "black", "blue", "green"], label="Hair color", info="Blond is cool"),
226
+ gr.Checkbox(label="NSFW", info="πŸ‘€πŸ‘€πŸ‘€")
227
  ],
228
  flagging_options=["blurry", "incorrect", "other"],
229
  outputs=[gr.Textbox(label="Answer", lines=3), gr.Image(label="Generated Image", type="filepath")],