Upload folder using huggingface_hub
Browse files- core/pipelines/sd_image_pipeline.py +20 -17
- requirements.txt +1 -1
core/pipelines/sd_image_pipeline.py
CHANGED
|
@@ -198,13 +198,14 @@ class SdImagePipeline(BasePipeline):
|
|
| 198 |
|
| 199 |
if task_type == 'img2img':
|
| 200 |
input_image_pil = ui_inputs.get('img2img_image')
|
| 201 |
-
if input_image_pil:
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
| 208 |
|
| 209 |
elif task_type == 'inpaint':
|
| 210 |
inpaint_dict = ui_inputs.get('inpaint_image_dict')
|
|
@@ -231,22 +232,24 @@ class SdImagePipeline(BasePipeline):
|
|
| 231 |
|
| 232 |
elif task_type == 'outpaint':
|
| 233 |
input_image_pil = ui_inputs.get('outpaint_image')
|
| 234 |
-
if input_image_pil:
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
|
|
|
| 239 |
|
| 240 |
ui_inputs['megapixels'] = 0.25
|
| 241 |
ui_inputs['grow_mask_by'] = ui_inputs.get('feathering', 10)
|
| 242 |
|
| 243 |
elif task_type == 'hires_fix':
|
| 244 |
input_image_pil = ui_inputs.get('hires_image')
|
| 245 |
-
if input_image_pil:
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
|
|
|
| 250 |
|
| 251 |
embedding_data = ui_inputs.get('embedding_data', [])
|
| 252 |
embedding_filenames = []
|
|
|
|
| 198 |
|
| 199 |
if task_type == 'img2img':
|
| 200 |
input_image_pil = ui_inputs.get('img2img_image')
|
| 201 |
+
if not input_image_pil:
|
| 202 |
+
raise gr.Error("Please upload an image for Image-to-Image.")
|
| 203 |
+
temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
|
| 204 |
+
input_image_pil.save(temp_file_path, "PNG")
|
| 205 |
+
ui_inputs['input_image'] = os.path.basename(temp_file_path)
|
| 206 |
+
temp_files_to_clean.append(temp_file_path)
|
| 207 |
+
ui_inputs['width'] = input_image_pil.width
|
| 208 |
+
ui_inputs['height'] = input_image_pil.height
|
| 209 |
|
| 210 |
elif task_type == 'inpaint':
|
| 211 |
inpaint_dict = ui_inputs.get('inpaint_image_dict')
|
|
|
|
| 232 |
|
| 233 |
elif task_type == 'outpaint':
|
| 234 |
input_image_pil = ui_inputs.get('outpaint_image')
|
| 235 |
+
if not input_image_pil:
|
| 236 |
+
raise gr.Error("Please upload an image for Outpainting.")
|
| 237 |
+
temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
|
| 238 |
+
input_image_pil.save(temp_file_path, "PNG")
|
| 239 |
+
ui_inputs['input_image'] = os.path.basename(temp_file_path)
|
| 240 |
+
temp_files_to_clean.append(temp_file_path)
|
| 241 |
|
| 242 |
ui_inputs['megapixels'] = 0.25
|
| 243 |
ui_inputs['grow_mask_by'] = ui_inputs.get('feathering', 10)
|
| 244 |
|
| 245 |
elif task_type == 'hires_fix':
|
| 246 |
input_image_pil = ui_inputs.get('hires_image')
|
| 247 |
+
if not input_image_pil:
|
| 248 |
+
raise gr.Error("Please upload an image for Hires Fix.")
|
| 249 |
+
temp_file_path = os.path.join(INPUT_DIR, f"temp_input_{random.randint(1000, 9999)}.png")
|
| 250 |
+
input_image_pil.save(temp_file_path, "PNG")
|
| 251 |
+
ui_inputs['input_image'] = os.path.basename(temp_file_path)
|
| 252 |
+
temp_files_to_clean.append(temp_file_path)
|
| 253 |
|
| 254 |
embedding_data = ui_inputs.get('embedding_data', [])
|
| 255 |
embedding_filenames = []
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
comfyui-frontend-package==1.43.18
|
| 2 |
-
comfyui-workflow-templates==0.9.
|
| 3 |
comfyui-embedded-docs==0.4.4
|
| 4 |
torch==2.10.0
|
| 5 |
torchsde
|
|
|
|
| 1 |
comfyui-frontend-package==1.43.18
|
| 2 |
+
comfyui-workflow-templates==0.9.73
|
| 3 |
comfyui-embedded-docs==0.4.4
|
| 4 |
torch==2.10.0
|
| 5 |
torchsde
|