X-HighVoltage-X commited on
Commit
3cb83a6
·
verified ·
1 Parent(s): f1d8157

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -11,7 +11,12 @@ MAX_SEED = np.iinfo(np.int32).max
11
  pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16)
12
  lora_repo = "strangerzonehf/Flux-Super-Realism-LoRA"
13
  trigger_word = "Super Realism"
 
 
 
 
14
  pipe.load_lora_weights(lora_repo)
 
15
  pipe.to("cuda")
16
 
17
  # reference https://huggingface.co/spaces/black-forest-labs/FLUX.1-Fill-dev/blob/main/app.py
@@ -66,8 +71,13 @@ def inpaint(
66
  mask = mask.convert("L")
67
  width, height = calculate_optimal_dimensions(image)
68
 
 
69
  if trigger_word:
70
- prompt = f"{trigger_word} {prompt}"
 
 
 
 
71
 
72
  if not isinstance(seed, int) or seed <= 0:
73
  seed = random.randint(0, MAX_SEED)
@@ -75,7 +85,7 @@ def inpaint(
75
  result = pipe(
76
  image=image,
77
  mask_image=mask,
78
- prompt=prompt,
79
  width=width,
80
  height=height,
81
  num_inference_steps=num_inference_steps,
@@ -85,7 +95,7 @@ def inpaint(
85
 
86
  result = result.convert("RGBA")
87
 
88
- return result, prompt, seed
89
 
90
  demo = gr.Interface(
91
  fn=inpaint,
 
11
  pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16)
12
  lora_repo = "strangerzonehf/Flux-Super-Realism-LoRA"
13
  trigger_word = "Super Realism"
14
+
15
+ lora_repo_2 = "strangerzonehf/Flux-SuperPortrait-v2-LoRA"
16
+ trigger_word_2 = "Super Portrait v2"
17
+
18
  pipe.load_lora_weights(lora_repo)
19
+ pipe.load_lora_weights(lora_repo_2)
20
  pipe.to("cuda")
21
 
22
  # reference https://huggingface.co/spaces/black-forest-labs/FLUX.1-Fill-dev/blob/main/app.py
 
71
  mask = mask.convert("L")
72
  width, height = calculate_optimal_dimensions(image)
73
 
74
+ final_prompt = ""
75
  if trigger_word:
76
+ prompt = f"{trigger_word}\n\n"
77
+ if trigger_word_2:
78
+ prompt = f"{trigger_word_2}\n\n"
79
+
80
+ final_prompt += prompt
81
 
82
  if not isinstance(seed, int) or seed <= 0:
83
  seed = random.randint(0, MAX_SEED)
 
85
  result = pipe(
86
  image=image,
87
  mask_image=mask,
88
+ prompt=final_prompt,
89
  width=width,
90
  height=height,
91
  num_inference_steps=num_inference_steps,
 
95
 
96
  result = result.convert("RGBA")
97
 
98
+ return result, final_prompt, seed
99
 
100
  demo = gr.Interface(
101
  fn=inpaint,