Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ class ImageProcessor:
|
|
45 |
|
46 |
# Initialize the image processor
|
47 |
base_path = "black-forest-labs/FLUX.1-dev"
|
48 |
-
lora_base_path = "
|
49 |
style_lora_base_path = "Shakker-Labs"
|
50 |
processor = ImageProcessor(base_path)
|
51 |
|
@@ -54,18 +54,10 @@ def single_condition_generate_image(prompt, subject_img, spatial_img, height, wi
|
|
54 |
# Set the control type
|
55 |
if control_type == "subject":
|
56 |
lora_path = os.path.join(lora_base_path, "subject.safetensors")
|
57 |
-
elif control_type == "depth":
|
58 |
-
lora_path = os.path.join(lora_base_path, "depth.safetensors")
|
59 |
-
elif control_type == "seg":
|
60 |
-
lora_path = os.path.join(lora_base_path, "seg.safetensors")
|
61 |
elif control_type == "pose":
|
62 |
lora_path = os.path.join(lora_base_path, "pose.safetensors")
|
63 |
elif control_type == "inpainting":
|
64 |
lora_path = os.path.join(lora_base_path, "inpainting.safetensors")
|
65 |
-
elif control_type == "hedsketch":
|
66 |
-
lora_path = os.path.join(lora_base_path, "hedsketch.safetensors")
|
67 |
-
elif control_type == "canny":
|
68 |
-
lora_path = os.path.join(lora_base_path, "canny.safetensors")
|
69 |
set_single_lora(processor.pipe.transformer, lora_path, lora_weights=[1], cond_size=512)
|
70 |
|
71 |
# Set the style LoRA
|
@@ -104,12 +96,12 @@ def multi_condition_generate_image(prompt, subject_img, spatial_img, height, wid
|
|
104 |
return image
|
105 |
|
106 |
# Define the Gradio interface components
|
107 |
-
control_types = ["subject", "
|
108 |
style_loras = ["Simple_Sketch", "Text_Poster", "Vector_Style", "None"]
|
109 |
|
110 |
# Example data
|
111 |
single_examples = [
|
112 |
-
["A SKS in the library", Image.open("./test_imgs/subject1.png"), None, 1024, 1024, 5, "subject", None],
|
113 |
["In a picturesque village, a narrow cobblestone street with rustic stone buildings, colorful blinds, and lush green spaces, a cartoon man drawn with simple lines and solid colors stands in the foreground, wearing a red shirt, beige work pants, and brown shoes, carrying a strap on his shoulder. The scene features warm and enticing colors, a pleasant fusion of nature and architecture, and the camera's perspective on the street clearly shows the charming and quaint environment., Integrating elements of reality and cartoon.", None, Image.open("./test_imgs/spatial1.png"), 1024, 1024, 1, "pose", "Vector_Style"],
|
114 |
]
|
115 |
multi_examples = [
|
|
|
45 |
|
46 |
# Initialize the image processor
|
47 |
base_path = "black-forest-labs/FLUX.1-dev"
|
48 |
+
lora_base_path = "./models"
|
49 |
style_lora_base_path = "Shakker-Labs"
|
50 |
processor = ImageProcessor(base_path)
|
51 |
|
|
|
54 |
# Set the control type
|
55 |
if control_type == "subject":
|
56 |
lora_path = os.path.join(lora_base_path, "subject.safetensors")
|
|
|
|
|
|
|
|
|
57 |
elif control_type == "pose":
|
58 |
lora_path = os.path.join(lora_base_path, "pose.safetensors")
|
59 |
elif control_type == "inpainting":
|
60 |
lora_path = os.path.join(lora_base_path, "inpainting.safetensors")
|
|
|
|
|
|
|
|
|
61 |
set_single_lora(processor.pipe.transformer, lora_path, lora_weights=[1], cond_size=512)
|
62 |
|
63 |
# Set the style LoRA
|
|
|
96 |
return image
|
97 |
|
98 |
# Define the Gradio interface components
|
99 |
+
control_types = ["subject", "pose", "inpainting"]
|
100 |
style_loras = ["Simple_Sketch", "Text_Poster", "Vector_Style", "None"]
|
101 |
|
102 |
# Example data
|
103 |
single_examples = [
|
104 |
+
["A SKS in the library", Image.open("./test_imgs/subject1.png"), None, 1024, 1024, 5, "subject", "None"],
|
105 |
["In a picturesque village, a narrow cobblestone street with rustic stone buildings, colorful blinds, and lush green spaces, a cartoon man drawn with simple lines and solid colors stands in the foreground, wearing a red shirt, beige work pants, and brown shoes, carrying a strap on his shoulder. The scene features warm and enticing colors, a pleasant fusion of nature and architecture, and the camera's perspective on the street clearly shows the charming and quaint environment., Integrating elements of reality and cartoon.", None, Image.open("./test_imgs/spatial1.png"), 1024, 1024, 1, "pose", "Vector_Style"],
|
106 |
]
|
107 |
multi_examples = [
|