Richard Neuschulz commited on
Commit
f233c1b
1 Parent(s): f7bec2c

uppdated app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -48,7 +48,7 @@ def generate_image(images, prompt, negative_prompt, face_strength, likeness_stre
48
  # Start the process
49
  pipe.to(device)
50
  app = FaceAnalysis(name="buffalo_l", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
51
- app.prepare(ctx_id=0, det_size=(640, 640))
52
 
53
  faceid_all_embeds = []
54
  for image in images:
@@ -67,6 +67,9 @@ def generate_image(images, prompt, negative_prompt, face_strength, likeness_stre
67
  scale=likeness_strength, width=1024, height=1024, guidance_scale=face_strength, num_inference_steps=30
68
  )
69
 
 
 
 
70
  print(image)
71
  return image
72
 
@@ -93,7 +96,7 @@ with gr.Blocks(css=css) as demo:
93
  prompt = gr.Textbox(label="Prompt",
94
  info="Try something like 'a photo of a man/woman/person'",
95
  placeholder="A photo of a [man/woman/person]...",
96
- value="A photo of a man, professional photoshoot, plain black shirt, on plain black background, shaved head, trimmed beard, wrinkles on forehead, intense, stoic, dramatic lighting")
97
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="low quality", value="low quality, worst quality")
98
  style = "Photorealistic"
99
  submit = gr.Button("Submit")
 
48
  # Start the process
49
  pipe.to(device)
50
  app = FaceAnalysis(name="buffalo_l", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
51
+ app.prepare(ctx_id=0, det_size=(512, 512))
52
 
53
  faceid_all_embeds = []
54
  for image in images:
 
67
  scale=likeness_strength, width=1024, height=1024, guidance_scale=face_strength, num_inference_steps=30
68
  )
69
 
70
+ # Clear GPU memory
71
+ torch.cuda.empty_cache()
72
+
73
  print(image)
74
  return image
75
 
 
96
  prompt = gr.Textbox(label="Prompt",
97
  info="Try something like 'a photo of a man/woman/person'",
98
  placeholder="A photo of a [man/woman/person]...",
99
+ value="A photo of a man, looking directly at camera, professional photoshoot, plain black shirt, on plain black background, shaved head, trimmed beard, stoic, dynamic lighting")
100
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="low quality", value="low quality, worst quality")
101
  style = "Photorealistic"
102
  submit = gr.Button("Submit")