Spaces:
Running
on
Zero
Running
on
Zero
Update UI
Browse files
app.py
CHANGED
@@ -21,7 +21,6 @@ folder_of_lora_weights = "./ID-Booth_LoRA_weights"
|
|
21 |
which_checkpoint = "checkpoint-31-6400"
|
22 |
lora_name = "pytorch_lora_weights.safetensors"
|
23 |
|
24 |
-
selected_identity = gr.State(value="ID_0") # Default selection
|
25 |
folder_of_identity_images = "./assets/example_images/"
|
26 |
|
27 |
backgrounds_list = ["Forest", "City street", "Beach", "Office", "Bus", "Laboratory", "Factory", "Construction site", "Hospital", "Night club", ""]
|
@@ -34,7 +33,7 @@ image_size = 512
|
|
34 |
|
35 |
@spaces.GPU # Uncomment if using ZeroGPU
|
36 |
def infer(
|
37 |
-
|
38 |
background,
|
39 |
pose,
|
40 |
negative_prompt,
|
@@ -46,7 +45,7 @@ def infer(
|
|
46 |
num_images=1
|
47 |
):
|
48 |
|
49 |
-
full_lora_weights_path = f"{folder_of_lora_weights}/{
|
50 |
pipe.load_lora_weights(full_lora_weights_path)
|
51 |
|
52 |
if randomize_seed:
|
@@ -54,8 +53,7 @@ def infer(
|
|
54 |
|
55 |
generator = torch.Generator().manual_seed(seed)
|
56 |
|
57 |
-
|
58 |
-
gender = gender_dict[selected_identity]
|
59 |
|
60 |
# Construct prompt from dropdown selections
|
61 |
prompt = f"face {pose.lower()} photo of {gender} sks person, {background.lower()} background"
|
|
|
21 |
which_checkpoint = "checkpoint-31-6400"
|
22 |
lora_name = "pytorch_lora_weights.safetensors"
|
23 |
|
|
|
24 |
folder_of_identity_images = "./assets/example_images/"
|
25 |
|
26 |
backgrounds_list = ["Forest", "City street", "Beach", "Office", "Bus", "Laboratory", "Factory", "Construction site", "Hospital", "Night club", ""]
|
|
|
33 |
|
34 |
@spaces.GPU # Uncomment if using ZeroGPU
|
35 |
def infer(
|
36 |
+
identity,
|
37 |
background,
|
38 |
pose,
|
39 |
negative_prompt,
|
|
|
45 |
num_images=1
|
46 |
):
|
47 |
|
48 |
+
full_lora_weights_path = f"{folder_of_lora_weights}/{identity}/{which_checkpoint}/{lora_name}"
|
49 |
pipe.load_lora_weights(full_lora_weights_path)
|
50 |
|
51 |
if randomize_seed:
|
|
|
53 |
|
54 |
generator = torch.Generator().manual_seed(seed)
|
55 |
|
56 |
+
gender = gender_dict[identity]
|
|
|
57 |
|
58 |
# Construct prompt from dropdown selections
|
59 |
prompt = f"face {pose.lower()} photo of {gender} sks person, {background.lower()} background"
|