ciover2024 commited on
Commit
6b98e01
1 Parent(s): c7bf0c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -0
app.py CHANGED
@@ -110,6 +110,60 @@ def resize_to_match(input_image, output_image):
110
 
111
  return output_image.resize(input_image.size, Image.BICUBIC) # Use BILINEAR for faster resizing
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  # Function to generate the mask using Florence SAM Masking API (Replicate)
114
  def generate_mask(image_path, text_prompt="clothing"):
115
  client_sam = Client("SkalskiP/florence-sam-masking")
 
110
 
111
  return output_image.resize(input_image.size, Image.BICUBIC) # Use BILINEAR for faster resizing
112
 
113
+ def generate_image(image_path, mask_path, text_prompt="undress"):
114
+ result = client.predict(
115
+ "", # str in 'parameter_10' Textbox component
116
+ "", # str in 'Negative Prompt' Textbox component
117
+ ["Fooocus V2","Fooocus Enhance","Fooocus Sharp"], # List[str] in 'Selected Styles' Checkboxgroup component
118
+ "Quality", # str in 'Performance' Radio component
119
+ '704×1408 <span style="color: grey;"> ∣ 1:2</span>', # str in 'Aspect Ratios' Radio component
120
+ 1, # int | float (numeric value between 1 and 32) in 'Image Number' Slider component
121
+ "-1", # str in 'Seed' Textbox component
122
+ 0, # int | float (numeric value between 0.0 and 30.0) in 'Image Sharpness' Slider component
123
+ 1, # int | float (numeric value between 1.0 and 30.0) in 'Guidance Scale' Slider component
124
+ "juggernautXL_version6Rundiffusion.safetensors", # str (Option from: ['ACertainty.ckpt', 'ACertainty.safetensors', 'juggernautXL_version6Rundiffusion.safetensors']) in 'Base Model (SDXL only)' Dropdown component
125
+ "None", # str (Option from: ['None', 'ACertainty.ckpt', 'ACertainty.safetensors', 'juggernautXL_version6Rundiffusion.safetensors']) in 'Refiner (SDXL or SD 1.5)' Dropdown component
126
+ 0.1, # int | float (numeric value between 0.1 and 1.0) in 'Refiner Switch At' Slider component
127
+ "None", # str (Option from: ['None', 'sdxl_lcm_lora.safetensors', 'sd_xl_offset_example-lora_1.0.safetensors']) in 'LoRA 1' Dropdown component
128
+ -2, # int | float (numeric value between -2 and 2) in 'Weight' Slider component
129
+ "None", # str (Option from: ['None', 'sdxl_lcm_lora.safetensors', 'sd_xl_offset_example-lora_1.0.safetensors']) in 'LoRA 2' Dropdown component
130
+ -2, # int | float (numeric value between -2 and 2) in 'Weight' Slider component
131
+ "None", # str (Option from: ['None', 'sdxl_lcm_lora.safetensors', 'sd_xl_offset_example-lora_1.0.safetensors']) in 'LoRA 3' Dropdown component
132
+ -2, # int | float (numeric value between -2 and 2) in 'Weight' Slider component
133
+ "None", # str (Option from: ['None', 'sdxl_lcm_lora.safetensors', 'sd_xl_offset_example-lora_1.0.safetensors']) in 'LoRA 4' Dropdown component
134
+ -2, # int | float (numeric value between -2 and 2) in 'Weight' Slider component
135
+ "None", # str (Option from: ['None', 'sdxl_lcm_lora.safetensors', 'sd_xl_offset_example-lora_1.0.safetensors']) in 'LoRA 5' Dropdown component
136
+ -2, # int | float (numeric value between -2 and 2) in 'Weight' Slider component
137
+ True, # bool in 'Input Image' Checkbox component
138
+ "", # str in 'parameter_85' Textbox component
139
+ "Disabled", # str in 'Upscale or Variation:' Radio component
140
+ None, # str (filepath or URL to image) in 'Drag above image to here' Image component
141
+ [], # List[str] in 'Outpaint Direction' Checkboxgroup component
142
+
143
+ image_path, # str (filepath or URL to image) in 'Drag inpaint or outpaint image to here' Image component
144
+ "", # str in 'Inpaint Additional Prompt' Textbox component
145
+ mask_path, # str (filepath or URL to image) in 'Mask Upload' Image component
146
+
147
+ image_path, # str (filepath or URL to image) in 'Image' Image component
148
+ 0, # int | float (numeric value between 0.0 and 1.0) in 'Stop At' Slider component
149
+ 0, # int | float (numeric value between 0.0 and 2.0) in 'Weight' Slider component
150
+ "ImagePrompt", # str in 'Type' Radio component
151
+ None, # str (filepath or URL to image) in 'Image' Image component
152
+ 0, # int | float (numeric value between 0.0 and 1.0) in 'Stop At' Slider component
153
+ 0, # int | float (numeric value between 0.0 and 2.0) in 'Weight' Slider component
154
+ "ImagePrompt", # str in 'Type' Radio component
155
+ None, # str (filepath or URL to image) in 'Image' Image component
156
+ 0, # int | float (numeric value between 0.0 and 1.0) in 'Stop At' Slider component
157
+ 0, # int | float (numeric value between 0.0 and 2.0) in 'Weight' Slider component
158
+ "ImagePrompt", # str in 'Type' Radio component
159
+ None, # str (filepath or URL to image) in 'Image' Image component
160
+ 0, # int | float (numeric value between 0.0 and 1.0) in 'Stop At' Slider component
161
+ 0, # int | float (numeric value between 0.0 and 2.0) in 'Weight' Slider component
162
+ "ImagePrompt", # str in 'Type' Radio component
163
+
164
+ fn_index=33
165
+ )
166
+
167
  # Function to generate the mask using Florence SAM Masking API (Replicate)
168
  def generate_mask(image_path, text_prompt="clothing"):
169
  client_sam = Client("SkalskiP/florence-sam-masking")