{ "cells": [ { "cell_type": "code", "execution_count": 232, "id": "f000e485-ba7d-4d12-ad00-67cc7f2512be", "metadata": { "tags": [] }, "outputs": [], "source": [ "import os\n", "import zipfile\n", "import shutil\n", "import time\n", "from PIL import Image, ImageDraw, ImageFilter\n", "import io\n", "from rembg import remove\n", "import json\n", "from transformers import pipeline\n", "import numpy as np\n", "from concurrent.futures import ThreadPoolExecutor\n", "import gradio as gr\n", "\n", "\n", "def remove_background_rembg(input_path):\n", "\tprint(f\"Removing background using rembg for image: {input_path}\")\n", "\twith open(input_path, 'rb') as i:\n", "\t\tinput_image = i.read()\n", "\toutput_image = remove(input_image)\n", "\timg = Image.open(io.BytesIO(output_image)).convert(\"RGBA\")\n", "\treturn img\n", "\n", "def remove_background_bria(input_path):\n", "\tprint(f\"Removing background using bria for image: {input_path}\")\n", "\tpipe = pipeline(\"image-segmentation\", model=\"briaai/RMBG-1.4\", trust_remote_code=True)\n", "\tpillow_image = pipe(input_path)\n", "\treturn pillow_image\n", "\n", "###### PlACE TO PUT ANOTHER MODEL #######\n", "\n", "def get_bounding_box_with_threshold(image, threshold):\n", "\t# Convert image to numpy array\n", "\timg_array = np.array(image)\n", " \n", "\t# Get alpha channel\n", "\talpha = img_array[:,:,3]\n", " \n", "\t# Find rows and columns where alpha > threshold\n", "\trows = np.any(alpha > threshold, axis=1)\n", "\tcols = np.any(alpha > threshold, axis=0)\n", " \n", "\t# Find the bounding box\n", "\ttop, bottom = np.where(rows)[0][[0, -1]]\n", "\tleft, right = np.where(cols)[0][[0, -1]]\n", " \n", "\tif left < right and top < bottom:\n", "\t\treturn (left, top, right, bottom)\n", "\telse:\n", "\t\treturn None\n", "\n", "def position_logic(image_path, canvas_size, padding_top, padding_right, padding_bottom, padding_left, use_threshold=True):\n", " image = Image.open(image_path)\n", " image = image.convert(\"RGBA\")\n", "\n", " # Get the bounding box of the non-blank area with threshold\n", " if use_threshold:\n", " bbox = get_bounding_box_with_threshold(image, threshold=10)\n", " else:\n", " bbox = image.getbbox()\n", " log = []\n", "\n", " if bbox:\n", " # Check 1 pixel around the image for non-transparent pixels\n", " width, height = image.size\n", " cropped_sides = []\n", " \n", " # Define tolerance for transparency\n", " tolerance = 30 # Adjust this value as needed\n", " \n", " # Check top edge\n", " if any(image.getpixel((x, 0))[3] > tolerance for x in range(width)):\n", " cropped_sides.append(\"top\")\n", " \n", " # Check bottom edge\n", " if any(image.getpixel((x, height-1))[3] > tolerance for x in range(width)):\n", " cropped_sides.append(\"bottom\")\n", " \n", " # Check left edge\n", " if any(image.getpixel((0, y))[3] > tolerance for y in range(height)):\n", " cropped_sides.append(\"left\")\n", " \n", " # Check right edge\n", " if any(image.getpixel((width-1, y))[3] > tolerance for y in range(height)):\n", " cropped_sides.append(\"right\")\n", " \n", " if cropped_sides:\n", " info_message = f\"Info for {os.path.basename(image_path)}: The following sides of the image may contain cropped objects: {', '.join(cropped_sides)}\"\n", " print(info_message)\n", " log.append({\"info\": info_message})\n", " else:\n", " info_message = f\"Info for {os.path.basename(image_path)}: The image is not cropped.\"\n", " print(info_message)\n", " log.append({\"info\": info_message})\n", " \n", " # Crop the image to the bounding box\n", " image = image.crop(bbox)\n", " log.append({\"action\": \"crop\", \"bbox\": [str(bbox[0]), str(bbox[1]), str(bbox[2]), str(bbox[3])]})\n", " \n", " # Calculate the new size to expand the image\n", " target_width, target_height = canvas_size\n", " aspect_ratio = image.width / image.height\n", " \n", " if len(cropped_sides) == 4:\n", " # If the image is cropped on all sides, center crop it to fit the canvas\n", " if aspect_ratio > 1: # Landscape\n", " new_height = target_height\n", " new_width = int(new_height * aspect_ratio)\n", " left = (new_width - target_width) // 2\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " image = image.crop((left, 0, left + target_width, target_height))\n", " else: # Portrait or square\n", " new_width = target_width\n", " new_height = int(new_width / aspect_ratio)\n", " top = (new_height - target_height) // 2\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " image = image.crop((0, top, target_width, top + target_height))\n", " log.append({\"action\": \"center_crop_resize\", \"new_size\": f\"{target_width}x{target_height}\"})\n", " x, y = 0, 0\n", " elif not cropped_sides:\n", " # If the image is not cropped, expand it from center until it touches the padding\n", " new_height = target_height - padding_top - padding_bottom\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " if new_width > target_width - padding_left - padding_right:\n", " # If width exceeds available space, adjust based on width\n", " new_width = target_width - padding_left - padding_right\n", " new_height = int(new_width / aspect_ratio)\n", " \n", " # Resize the image\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " x = (target_width - new_width) // 2\n", " y = target_height - new_height - padding_bottom\n", " else:\n", " # New logic for handling cropped top and left, or top and right\n", " if set(cropped_sides) == {\"top\", \"left\"} or set(cropped_sides) == {\"top\", \"right\"}:\n", " new_height = target_height - padding_bottom\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " # If new width exceeds canvas width, adjust based on width\n", " if new_width > target_width:\n", " new_width = target_width\n", " new_height = int(new_width / aspect_ratio)\n", " \n", " # Resize the image\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " # Set position\n", " if \"left\" in cropped_sides:\n", " x = 0\n", " else: # right in cropped_sides\n", " x = target_width - new_width\n", " y = 0\n", " \n", " # If the resized image is taller than the canvas minus padding, crop from the bottom\n", " if new_height > target_height - padding_bottom:\n", " crop_bottom = new_height - (target_height - padding_bottom)\n", " image = image.crop((0, 0, new_width, new_height - crop_bottom))\n", " new_height = target_height - padding_bottom\n", " log.append({\"action\": \"crop_vertical\", \"bottom_pixels_removed\": str(crop_bottom)})\n", " \n", " log.append({\"action\": \"position\", \"x\": str(x), \"y\": str(y)})\n", " elif set(cropped_sides) == {\"bottom\", \"left\"} or set(cropped_sides) == {\"bottom\", \"right\"}:\n", " # Handle bottom & left or bottom & right cropped images\n", " new_height = target_height - padding_top\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " # If new width exceeds canvas width, adjust based on width\n", " if new_width > target_width - padding_left - padding_right:\n", " new_width = target_width - padding_left - padding_right\n", " new_height = int(new_width / aspect_ratio)\n", " \n", " # Resize the image without cropping or stretching\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " # Set position\n", " if \"left\" in cropped_sides:\n", " x = 0\n", " else: # right in cropped_sides\n", " x = target_width - new_width\n", " y = target_height - new_height\n", " \n", " log.append({\"action\": \"position\", \"x\": str(x), \"y\": str(y)})\n", " elif set(cropped_sides) == {\"bottom\", \"left\", \"right\"}:\n", " # Expand the image from the center\n", " new_width = target_width\n", " new_height = int(new_width / aspect_ratio)\n", " \n", " if new_height < target_height:\n", " new_height = target_height\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " \n", " # Crop to fit the canvas\n", " left = (new_width - target_width) // 2\n", " top = 0\n", " image = image.crop((left, top, left + target_width, top + target_height))\n", " \n", " log.append({\"action\": \"expand_and_crop\", \"new_size\": f\"{target_width}x{target_height}\"})\n", " x, y = 0, 0\n", " elif cropped_sides == [\"top\"]:\n", " # New logic for handling only top-cropped images\n", " if image.width > image.height:\n", " new_width = target_width\n", " new_height = int(target_width / aspect_ratio)\n", " else:\n", " new_height = target_height - padding_bottom\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " # Resize the image\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " x = (target_width - new_width) // 2\n", " y = 0 # Align to top\n", " \n", " # Apply padding only to non-cropped sides\n", " x = max(padding_left, min(x, target_width - new_width - padding_right))\n", " elif cropped_sides in [[\"right\"], [\"left\"]]:\n", " # New logic for handling only right-cropped or left-cropped images\n", " if image.width > image.height:\n", " new_width = target_width - max(padding_left, padding_right)\n", " new_height = int(new_width / aspect_ratio)\n", " else:\n", " new_height = target_height - padding_top - padding_bottom\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " # Resize the image\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " if cropped_sides == [\"right\"]:\n", " x = target_width - new_width # Align to right\n", " else: # cropped_sides == [\"left\"]\n", " x = 0 # Align to left\n", " y = target_height - new_height - padding_bottom # Respect bottom padding\n", " \n", " # Ensure top padding is respected\n", " if y < padding_top:\n", " y = padding_top\n", " \n", " log.append({\"action\": \"position\", \"x\": str(x), \"y\": str(y)})\n", " elif set(cropped_sides) == {\"left\", \"right\"}:\n", " # Logic for handling images cropped on both left and right sides\n", " new_width = target_width # Expand to full width of canvas\n", " \n", " # Calculate the aspect ratio of the original image\n", " aspect_ratio = image.width / image.height\n", " \n", " # Calculate the new height while maintaining aspect ratio\n", " new_height = int(new_width / aspect_ratio)\n", " \n", " # Resize the image\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " # Set horizontal position (always 0 as it spans full width)\n", " x = 0\n", " \n", " # Calculate vertical position to respect bottom padding\n", " y = target_height - new_height - padding_bottom\n", " \n", " # If the resized image is taller than the canvas, crop from the top only\n", " if new_height > target_height - padding_bottom:\n", " crop_top = new_height - (target_height - padding_bottom)\n", " image = image.crop((0, crop_top, new_width, new_height))\n", " new_height = target_height - padding_bottom\n", " y = 0\n", " log.append({\"action\": \"crop_vertical\", \"top_pixels_removed\": str(crop_top)})\n", " else:\n", " # Align the image to the bottom with padding\n", " y = target_height - new_height - padding_bottom\n", " \n", " log.append({\"action\": \"position\", \"x\": str(x), \"y\": str(y)})\n", " elif cropped_sides == [\"bottom\"]:\n", " # Logic for handling images cropped on the bottom side\n", " # Calculate the aspect ratio of the original image\n", " aspect_ratio = image.width / image.height\n", " \n", " if aspect_ratio < 1: # Portrait orientation\n", " new_height = target_height - padding_top # Full height with top padding\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " # If the new width exceeds the canvas width, adjust it\n", " if new_width > target_width:\n", " new_width = target_width\n", " new_height = int(new_width / aspect_ratio)\n", " else: # Landscape orientation\n", " new_width = target_width - padding_left - padding_right\n", " new_height = int(new_width / aspect_ratio)\n", " \n", " # If the new height exceeds the canvas height, adjust it\n", " if new_height > target_height:\n", " new_height = target_height\n", " new_width = int(new_height * aspect_ratio)\n", " \n", " # Resize the image\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " # Set horizontal position (centered)\n", " x = (target_width - new_width) // 2\n", " \n", " # Set vertical position (touching bottom edge for all cases)\n", " y = target_height - new_height\n", " \n", " log.append({\"action\": \"position\", \"x\": str(x), \"y\": str(y)})\n", " else:\n", " # Use the original resizing logic for other partially cropped images\n", " if image.width > image.height:\n", " new_width = target_width\n", " new_height = int(target_width / aspect_ratio)\n", " else:\n", " new_height = target_height\n", " new_width = int(target_height * aspect_ratio)\n", " \n", " # Resize the image\n", " image = image.resize((new_width, new_height), Image.LANCZOS)\n", " log.append({\"action\": \"resize\", \"new_width\": str(new_width), \"new_height\": str(new_height)})\n", " \n", " # Center horizontally for all images\n", " x = (target_width - new_width) // 2\n", " y = target_height - new_height - padding_bottom\n", " \n", " # Adjust positions for cropped sides\n", " if \"top\" in cropped_sides:\n", " y = 0\n", " elif \"bottom\" in cropped_sides:\n", " y = target_height - new_height\n", " if \"left\" in cropped_sides:\n", " x = 0\n", " elif \"right\" in cropped_sides:\n", " x = target_width - new_width\n", " \n", " # Apply padding only to non-cropped sides, but keep horizontal centering\n", " if \"left\" not in cropped_sides and \"right\" not in cropped_sides:\n", " x = (target_width - new_width) // 2 # Always center horizontally\n", " if \"top\" not in cropped_sides and \"bottom\" not in cropped_sides:\n", " y = max(padding_top, min(y, target_height - new_height - padding_bottom))\n", "\n", " return log, image, x, y\n", "\n" ] }, { "cell_type": "code", "execution_count": 233, "id": "76ca7d68-810c-4cac-a9a2-838f0a08e6fb", "metadata": {}, "outputs": [], "source": [ "def watermark_with_transparency(image, watermark_image_path): \n", " watermark = Image.open(watermark_image_path).convert(\"RGBA\")\n", " width, height = image.size\n", "\n", " # Resize watermark if it doesn't match the canvas size\n", " if watermark.size != image.size:\n", " watermark = watermark.resize(image.size, Image.LANCZOS)\n", " \n", " #Create new canvas and put the watermark on it \n", " transparent = Image.new('RGBA', (width, height), (0,0,0,0))\n", "\n", " # Paste the image to the watermark\n", " transparent.paste(watermark, ((transparent.width - watermark.width) // 2 , (transparent.width - watermark.height) // 2), watermark)\n", " # Paste the watermark to the image\n", " transparent.paste(image, ((transparent.width - width) // 2 , (transparent.width - height) // 2), image)\n", "\n", " \n", " return transparent\n", "\n" ] }, { "cell_type": "code", "execution_count": 234, "id": "5d368688-3579-4fa4-b129-e899fa42fbce", "metadata": { "tags": [] }, "outputs": [], "source": [ "def process_single_image(image_path, output_folder, bg_method, canvas_size_name, output_format, bg_choice, custom_color, watermark_path=None):\n", " add_padding_line = False\n", "\n", " if canvas_size_name == 'Rox':\n", " canvas_size = (1080, 1080)\n", " padding_top = 112\n", " padding_right = 125\n", " padding_bottom = 116\n", " padding_left = 125\n", " elif canvas_size_name == 'Columbia':\n", " canvas_size = (730, 610)\n", " padding_top = 30\n", " padding_right = 105\n", " padding_bottom = 35\n", " padding_left = 105\n", " elif canvas_size_name == 'Zalora':\n", " canvas_size = (763, 1100)\n", " padding_top = 50\n", " padding_right = 50\n", " padding_bottom = 200\n", " padding_left = 50\n", "\n", "\n", " filename = os.path.basename(image_path)\n", " try:\n", " print(f\"Processing image: {filename}\")\n", " if bg_method == 'rembg':\n", " image_with_no_bg = remove_background_rembg(image_path)\n", " elif bg_method == 'bria':\n", " image_with_no_bg = remove_background_bria(image_path)\n", " else:\n", " image_with_no_bg = Image.open(image_path).convert(\"RGBA\")\n", " \n", " temp_image_path = os.path.join(output_folder, f\"temp_{filename}\")\n", " image_with_no_bg.save(temp_image_path, format='PNG')\n", "\n", " log, new_image, x, y = position_logic(temp_image_path, canvas_size, padding_top, padding_right, padding_bottom, padding_left)\n", "\n", " # Create a new canvas with the appropriate background\n", " if bg_choice == 'white':\n", " canvas = Image.new(\"RGBA\", canvas_size, \"WHITE\")\n", " canvas.putalpha(120)\n", " canvas.paste(new_image, (x, y), new_image)\n", " \n", " elif bg_choice == 'custom':\n", " canvas = Image.new(\"RGBA\", canvas_size, custom_color)\n", " canvas.putalpha(120) \n", " canvas.paste(new_image, (x, y), new_image)\n", " \n", " elif bg_choice == \"blur\":\n", " # Create a blurred version of the entire image\n", " blurred = Image.open(image_path).convert(\"RGBA\")\n", " blurred = blurred.filter(ImageFilter.GaussianBlur(10))\n", " blurred = blurred.resize(new_image.size, Image.LANCZOS)\n", " # Resize the blurred image to fit the canvas\n", " canvas = blurred\n", " canvas.putalpha(90)\n", " canvas.paste(new_image, (0,0), new_image)\n", " \n", " else: # transparent\n", " canvas = Image.new(\"RGBA\", canvas_size, (0, 0, 0, 0))\n", " canvas.paste(new_image, (x, y), new_image)\n", " \n", " log.append({\"action\": \"paste\", \"position\": [str(x), str(y)]})\n", " \n", "\n", " # Add visible black line for padding when background is not transparent\n", " if add_padding_line:\n", " draw = ImageDraw.Draw(canvas)\n", " draw.rectangle([padding_left, padding_top, canvas_size[0] - padding_right, canvas_size[1] - padding_bottom], outline=\"black\", width=5)\n", " log.append({\"action\": \"add_padding_line\"})\n", "\n", " output_ext = 'jpg' if output_format == 'JPG' else 'png'\n", " output_filename = f\"{os.path.splitext(filename)[0]}.{output_ext}\"\n", " output_path = os.path.join(output_folder, output_filename)\n", " \n", " # Applying the watermark, if exist\n", " if watermark_path:\n", " try:\n", " canvas = watermark_with_transparency(canvas, watermark_path)\n", " log.append({\"action\": \"add_watermark\"})\n", " \n", " except Exception as e:\n", " print(f\"Error processing watermark: {e}\")\n", "\n", "\n", " output_ext = 'jpg' if output_format == 'JPG' else 'png'\n", " output_filename = f\"{os.path.splitext(filename)[0]}.{output_ext}\"\n", " output_path = os.path.join(output_folder, output_filename)\n", "\n", " if output_format == 'JPG':\n", " canvas.convert('RGB').save(output_path, format='JPEG')\n", " else:\n", " canvas.save(output_path, format='PNG')\n", " \n", " os.remove(temp_image_path)\n", "\n", " print(f\"Processed image path: {output_path}\")\n", " return [(output_path, image_path)], log\n", "\n", " except Exception as e:\n", " print(f\"Error processing {filename}: {e}\")\n", " return None, None\n", "\n", "######################################## WATERMARK PATH #############################################################\n", " \n", " \n", "def process_images(input_files, bg_method='rembg', watermark_path=None, canvas_size='Rox', output_format='PNG', bg_choice='transparent', custom_color=\"#ffffff\", num_workers=4, progress=gr.Progress()):\n", " start_time = time.time()\n", "\n", " output_folder = \"processed_images\"\n", " if os.path.exists(output_folder):\n", " shutil.rmtree(output_folder)\n", " os.makedirs(output_folder)\n", "\n", " processed_images = []\n", " original_images = []\n", " all_logs = []\n", "\n", " if isinstance(input_files, str) and input_files.lower().endswith(('.zip', '.rar')):\n", " # Handle zip file\n", " input_folder = \"temp_input\"\n", " if os.path.exists(input_folder):\n", " shutil.rmtree(input_folder)\n", " os.makedirs(input_folder)\n", " \n", " try:\n", " with zipfile.ZipFile(input_files, 'r') as zip_ref:\n", " zip_ref.extractall(input_folder)\n", " except zipfile.BadZipFile as e:\n", " print(f\"Error extracting zip file: {e}\")\n", " return [], None, 0\n", " \n", " image_files = [os.path.join(input_folder, f) for f in os.listdir(input_folder) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.bmp', '.gif', '.webp'))]\n", " elif isinstance(input_files, list):\n", " # Handle multiple files\n", " image_files = input_files\n", " else:\n", " # Handle single file\n", " image_files = [input_files]\n", "\n", " total_images = len(image_files)\n", " print(f\"Total images to process: {total_images}\")\n", "\n", " avg_processing_time = 0\n", " with ThreadPoolExecutor(max_workers=num_workers) as executor:\n", " future_to_image = {executor.submit(process_single_image, image_path, output_folder, bg_method, canvas_size, output_format, bg_choice, custom_color, watermark_path): image_path for image_path in image_files}\n", " for idx, future in enumerate(future_to_image):\n", " try:\n", " start_time_image = time.time()\n", " result, log = future.result()\n", " end_time_image = time.time()\n", " image_processing_time = end_time_image - start_time_image\n", " \n", " # Update average processing time\n", " avg_processing_time = (avg_processing_time * idx + image_processing_time) / (idx + 1)\n", " \n", " if result:\n", " processed_images.extend(result)\n", " original_images.append(future_to_image[future])\n", " \n", " all_logs.append({os.path.basename(future_to_image[future]): log})\n", " \n", " # Estimate remaining time\n", " remaining_images = total_images - (idx + 1)\n", " estimated_remaining_time = remaining_images * avg_processing_time\n", " \n", " progress((idx + 1) / total_images, f\"{idx + 1}/{total_images} images processed. Estimated time remaining: {estimated_remaining_time:.2f} seconds\")\n", " except Exception as e:\n", " print(f\"Error processing image {future_to_image[future]}: {e}\")\n", "\n", " output_zip_path = \"processed_images.zip\"\n", " with zipfile.ZipFile(output_zip_path, 'w') as zipf:\n", " for file, _ in processed_images:\n", " zipf.write(file, os.path.basename(file))\n", "\n", " # Write the comprehensive log for all images\n", " with open(os.path.join(output_folder, 'process_log.json'), 'w') as log_file:\n", " json.dump(all_logs, log_file, indent=4)\n", " print(\"Comprehensive log saved to\", os.path.join(output_folder, 'process_log.json'))\n", "\n", " end_time = time.time()\n", " processing_time = end_time - start_time\n", " print(f\"Processing time: {processing_time} seconds\")\n", "\n", "\n", " input_path = processed_images[0][1]\n", " output_path = processed_images[0][0]\n", " print(f\"{processed_images} | {input_path} | {output_path} | WATERMARK OBJECT: {watermark_path}\")\n", "\n", "\n", " return original_images, processed_images, output_zip_path, processing_time" ] }, { "cell_type": "code", "execution_count": 235, "id": "cd52ae59-8d8c-45ed-8bde-4e7ce2c4464f", "metadata": { "tags": [] }, "outputs": [], "source": [ "def gradio_interface(input_files, bg_method, watermark, canvas_size, output_format, bg_choice, custom_color, num_workers):\n", " progress = gr.Progress()\n", " watermark_path = watermark.name if watermark else None\n", " \n", " # Check input_files, is it single image, list image, or zip/rar\n", " if isinstance(input_files, str) and input_files.lower().endswith(('.zip', '.rar')):\n", " return process_images(input_files, bg_method, watermark_path, canvas_size, output_format, bg_choice, custom_color, num_workers, progress)\n", " elif isinstance(input_files, list):\n", " return process_images(input_files, bg_method, watermark_path, canvas_size, output_format, bg_choice, custom_color, num_workers, progress)\n", " else:\n", " return process_images(input_files.name, bg_method, watermark_path, canvas_size, output_format, bg_choice, custom_color, num_workers, progress)\n", "\n", "def show_color_picker(bg_choice):\n", " if bg_choice == 'custom':\n", " return gr.update(visible=True)\n", " return gr.update(visible=False)\n", "\n", "def update_compare(evt: gr.SelectData):\n", " print(f\"Selected value: {evt.value}\") # Debug print\n", " \n", " try:\n", " if isinstance(evt.value, list) and len(evt.value) == 2:\n", " _, combined_path = evt.value\n", " if '|' in combined_path:\n", " output_path, input_path = combined_path.split('|')\n", " else:\n", " raise ValueError(f\"Unexpected format in second element: {combined_path}\")\n", " elif isinstance(evt.value, str):\n", " if '|' in evt.value:\n", " output_path, input_path = evt.value.split('|')\n", " else:\n", " raise ValueError(f\"Unexpected string format: {evt.value}\")\n", " else:\n", " raise ValueError(f\"Unexpected input format: {evt.value}\")\n", " \n", " # Remove any URL prefix from the paths\n", " output_path = output_path.split('=')[-1] if '=' in output_path else output_path\n", " input_path = input_path.split('=')[-1] if '=' in input_path else input_path\n", " \n", " # Open the original and processed images\n", " original_img = Image.open(input_path)\n", " processed_img = Image.open(output_path)\n", " \n", " # Calculate the aspect ratios\n", " original_ratio = f\"{original_img.width}x{original_img.height}\"\n", " processed_ratio = f\"{processed_img.width}x{processed_img.height}\"\n", " \n", " print(f\"Successfully processed. Input: {input_path}, Output: {output_path}\")\n", " return gr.update(value=input_path), gr.update(value=output_path), gr.update(value=original_ratio), gr.update(value=processed_ratio)\n", " except Exception as e:\n", " print(f\"Error in update_compare: {e}\")\n", " return gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None)\n", " \n", "def process(input_files, bg_method, watermark, canvas_size, output_format, bg_choice, custom_color, num_workers):\n", " _, processed_images, zip_path, time_taken = gradio_interface(input_files, bg_method, watermark, canvas_size, output_format, bg_choice, custom_color, num_workers)\n", " processed_images_with_captions = [\n", " [f\"{img}\", f\"{img}|{caption}\"] # Format to match the observed structure\n", " for img, caption in processed_images\n", " ]\n", " return processed_images_with_captions, zip_path, f\"{time_taken:.2f} seconds\"" ] }, { "cell_type": "code", "execution_count": 236, "id": "21f056e3-95ed-44d2-82f9-3551beda4f97", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7924\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 236, "metadata": {}, "output_type": "execute_result" }, { "name": "stdout", "output_type": "stream", "text": [ "IMPORTANT: You are using gradio version 3.50.2, however version 4.29.0 is available, please upgrade.\n", "--------\n", "Total images to process: 5\n", "Processing image: briefcase-mantap-FLUXXXX.jpeg\n", "Removing background using bria for image: temp_input\\briefcase-mantap-FLUXXXX.jpeg\n", "Processing image: FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Removing background using bria for image: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Processing image: happy-pamili_flux.png\n", "Removing background using bria for image: temp_input\\happy-pamili_flux.png\n", "Processing image: Luggage-Flux.png\n", "Removing background using bria for image: temp_input\\Luggage-Flux.png\n", "Processing image: SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Removing background using bria for image: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Info for temp_SUITCASEE-MAFIOSO-FLUX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Info for temp_happy-pamili_flux.png: The following sides of the image may contain cropped objects: bottom, right\n", "Processed image path: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Processed image path: processed_images\\happy-pamili_flux.jpg\n", "Info for temp_FAMILIAA-LUGGAGE_FLUXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Info for temp_briefcase-mantap-FLUXXXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Info for temp_Luggage-Flux.png: The image is not cropped.\n", "Processed image path: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Processed image path: processed_images\\Luggage-Flux.jpg\n", "Processed image path: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Comprehensive log saved to processed_images\\process_log.json\n", "Processing time: 18.81236243247986 seconds\n", "[('processed_images\\\\briefcase-mantap-FLUXXXX.jpg', 'temp_input\\\\briefcase-mantap-FLUXXXX.jpeg'), ('processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg'), ('processed_images\\\\happy-pamili_flux.jpg', 'temp_input\\\\happy-pamili_flux.png'), ('processed_images\\\\Luggage-Flux.jpg', 'temp_input\\\\Luggage-Flux.png'), ('processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg')] | temp_input\\briefcase-mantap-FLUXXXX.jpeg | processed_images\\briefcase-mantap-FLUXXXX.jpg | WATERMARK OBJECT: C:\\Users\\rezau\\AppData\\Local\\Temp\\gradio\\229a0676cb6905c411a225b47d11e523a896602c\\w-watermak.png\n", "Selected value: ['http://127.0.0.1:7924/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\c82049eccda561ecc1d29cb009339d1c50c45c20\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Selected value: ['http://127.0.0.1:7924/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\3ad150aa83f596dc5594f69cd689fd22c2b7c5ae\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7924/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\68656f624624cb9ef98af60465c090f8f44d5ebb\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7924/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\49a6a39d77202a0ce01253ed136879b8767d5bb8\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7924/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\530b14d53980f3842492cb453727e2834bd574fa\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Selected value: ['http://127.0.0.1:7924/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\49a6a39d77202a0ce01253ed136879b8767d5bb8\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n" ] } ], "source": [ "with gr.Blocks(theme=\"NoCrypt/miku@1.2.2\") as iface:\n", " gr.Markdown(\"# Image Background Removal and Resizing with Optional Watermark\")\n", " gr.Markdown(\"Choose to upload multiple images or a ZIP/RAR file, select the crop mode, optionally upload a watermark image, and choose the output format.\")\n", "\n", " with gr.Row():\n", " input_files = gr.File(label=\"Upload Image or ZIP/RAR file\", file_types=[\".zip\", \".rar\", \"image\"], interactive=True)\n", " watermark = gr.File(label=\"Upload Watermark Image (Optional)\", file_types=[\".png\"])\n", "\n", " with gr.Row():\n", " canvas_size = gr.Radio(choices=[\"Rox\", \"Columbia\", \"Zalora\"], label=\"Canvas Size\", value=\"Rox\")\n", " output_format = gr.Radio(choices=[\"PNG\", \"JPG\"], label=\"Output Format\", value=\"JPG\")\n", " num_workers = gr.Slider(minimum=1, maximum=16, step=1, label=\"Number of Workers\", value=5)\n", "\n", " with gr.Row():\n", " bg_method = gr.Radio(choices=[\"bria\", \"rembg\", \"none\"], label=\"Background Removal Method\", value=\"bria\")\n", " bg_choice = gr.Radio(choices=[\"transparent\", \"white\", \"custom\", \"blur\"], label=\"Background Choice\", value=\"transparent\")\n", " custom_color = gr.ColorPicker(label=\"Custom Background Color\", value=\"#ffffff\", visible=False)\n", "\n", " process_button = gr.Button(\"Process Images\")\n", "\n", " with gr.Row():\n", " gallery_processed = gr.Gallery(label=\"Processed Images\", show_label=True, elem_id=\"gallery\")\n", " with gr.Row():\n", " image_original = gr.Image(label=\"Original Images\", interactive=False)\n", " image_processed = gr.Image(label=\"Processed Images\", interactive=False)\n", " with gr.Row():\n", " original_ratio = gr.Textbox(label=\"Original Ratio\")\n", " processed_ratio = gr.Textbox(label=\"Processed Ratio\")\n", " with gr.Row():\n", " output_zip = gr.File(label=\"Download Processed Images as ZIP\")\n", " processing_time = gr.Textbox(label=\"Processing Time (seconds)\")\n", "\n", " bg_choice.change(show_color_picker, inputs=bg_choice, outputs=custom_color)\n", "\n", " \n", " process_button.click(process, inputs=[input_files, bg_method, watermark, canvas_size, output_format, bg_choice, custom_color, num_workers], outputs=[gallery_processed, output_zip, processing_time])\n", " gallery_processed.select(update_compare, outputs=[image_original, image_processed, original_ratio, processed_ratio])\n", " \n", "iface.launch()\n" ] }, { "cell_type": "code", "execution_count": 229, "id": "443861f4-4c0d-4c05-b68b-68637036632d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting diffusers\n", " Downloading diffusers-0.30.3-py3-none-any.whl.metadata (18 kB)\n", "Requirement already satisfied: importlib-metadata in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (7.0.1)\n", "Requirement already satisfied: filelock in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (3.13.1)\n", "Requirement already satisfied: huggingface-hub>=0.23.2 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (0.24.7)\n", "Requirement already satisfied: numpy in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (1.26.4)\n", "Requirement already satisfied: regex!=2019.12.17 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (2023.10.3)\n", "Requirement already satisfied: requests in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (2.32.2)\n", "Requirement already satisfied: safetensors>=0.3.1 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (0.4.2)\n", "Requirement already satisfied: Pillow in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from diffusers) (10.3.0)\n", "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.23.2->diffusers) (2024.3.1)\n", "Requirement already satisfied: packaging>=20.9 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.23.2->diffusers) (23.2)\n", "Requirement already satisfied: pyyaml>=5.1 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.23.2->diffusers) (6.0.1)\n", "Requirement already satisfied: tqdm>=4.42.1 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.23.2->diffusers) (4.66.4)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.23.2->diffusers) (4.11.0)\n", "Requirement already satisfied: zipp>=0.5 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from importlib-metadata->diffusers) (3.17.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->diffusers) (2.0.4)\n", "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->diffusers) (3.7)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->diffusers) (2.2.1)\n", "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->diffusers) (2024.8.30)\n", "Requirement already satisfied: colorama in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from tqdm>=4.42.1->huggingface-hub>=0.23.2->diffusers) (0.4.6)\n", "Downloading diffusers-0.30.3-py3-none-any.whl (2.7 MB)\n", " ---------------------------------------- 0.0/2.7 MB ? eta -:--:--\n", " --------------------------------------- 0.0/2.7 MB 2.0 MB/s eta 0:00:02\n", " ----- ---------------------------------- 0.4/2.7 MB 5.6 MB/s eta 0:00:01\n", " ---------- ----------------------------- 0.7/2.7 MB 6.1 MB/s eta 0:00:01\n", " --------------- ------------------------ 1.1/2.7 MB 6.7 MB/s eta 0:00:01\n", " --------------------- ------------------ 1.4/2.7 MB 7.0 MB/s eta 0:00:01\n", " -------------------------- ------------- 1.7/2.7 MB 6.9 MB/s eta 0:00:01\n", " ------------------------------ --------- 2.0/2.7 MB 6.8 MB/s eta 0:00:01\n", " ---------------------------------- ----- 2.3/2.7 MB 6.7 MB/s eta 0:00:01\n", " -------------------------------------- - 2.6/2.7 MB 6.6 MB/s eta 0:00:01\n", " ---------------------------------------- 2.7/2.7 MB 6.3 MB/s eta 0:00:00\n", "Installing collected packages: diffusers\n", "Successfully installed diffusers-0.30.3\n" ] } ], "source": [ "!pip install -U diffusers" ] }, { "cell_type": "code", "execution_count": 231, "id": "c456303f-018e-4275-b925-8ec4f29b9a4c", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting accelerate\n", " Downloading accelerate-0.34.2-py3-none-any.whl.metadata (19 kB)\n", "Requirement already satisfied: numpy<3.0.0,>=1.17 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from accelerate) (1.26.4)\n", "Requirement already satisfied: packaging>=20.0 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from accelerate) (23.2)\n", "Requirement already satisfied: psutil in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from accelerate) (6.0.0)\n", "Requirement already satisfied: pyyaml in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from accelerate) (6.0.1)\n", "Requirement already satisfied: torch>=1.10.0 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from accelerate) (2.4.1)\n", "Requirement already satisfied: huggingface-hub>=0.21.0 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from accelerate) (0.24.7)\n", "Collecting safetensors>=0.4.3 (from accelerate)\n", " Downloading safetensors-0.4.5-cp311-none-win_amd64.whl.metadata (3.9 kB)\n", "Requirement already satisfied: filelock in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.21.0->accelerate) (3.13.1)\n", "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.21.0->accelerate) (2024.3.1)\n", "Requirement already satisfied: requests in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.21.0->accelerate) (2.32.2)\n", "Requirement already satisfied: tqdm>=4.42.1 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.21.0->accelerate) (4.66.4)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from huggingface-hub>=0.21.0->accelerate) (4.11.0)\n", "Requirement already satisfied: sympy in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from torch>=1.10.0->accelerate) (1.12)\n", "Requirement already satisfied: networkx in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from torch>=1.10.0->accelerate) (3.2.1)\n", "Requirement already satisfied: jinja2 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from torch>=1.10.0->accelerate) (3.1.4)\n", "Requirement already satisfied: colorama in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from tqdm>=4.42.1->huggingface-hub>=0.21.0->accelerate) (0.4.6)\n", "Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from jinja2->torch>=1.10.0->accelerate) (2.1.3)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->huggingface-hub>=0.21.0->accelerate) (2.0.4)\n", "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->huggingface-hub>=0.21.0->accelerate) (3.7)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->huggingface-hub>=0.21.0->accelerate) (2.2.1)\n", "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from requests->huggingface-hub>=0.21.0->accelerate) (2024.8.30)\n", "Requirement already satisfied: mpmath>=0.19 in c:\\users\\rezau\\anaconda3\\envs\\ai-sensum\\lib\\site-packages (from sympy->torch>=1.10.0->accelerate) (1.3.0)\n", "Downloading accelerate-0.34.2-py3-none-any.whl (324 kB)\n", " ---------------------------------------- 0.0/324.4 kB ? eta -:--:--\n", " ----------- ---------------------------- 92.2/324.4 kB 1.7 MB/s eta 0:00:01\n", " --------------------------- ------------ 225.3/324.4 kB 2.3 MB/s eta 0:00:01\n", " ---------------------------------------- 324.4/324.4 kB 2.9 MB/s eta 0:00:00\n", "Downloading safetensors-0.4.5-cp311-none-win_amd64.whl (285 kB)\n", " ---------------------------------------- 0.0/286.0 kB ? eta -:--:--\n", " -------------------------------------- - 276.5/286.0 kB 5.7 MB/s eta 0:00:01\n", " ---------------------------------------- 286.0/286.0 kB 5.9 MB/s eta 0:00:00\n", "Installing collected packages: safetensors, accelerate\n", " Attempting uninstall: safetensors\n", " Found existing installation: safetensors 0.4.2\n", " Uninstalling safetensors-0.4.2:\n", " Successfully uninstalled safetensors-0.4.2\n", "Successfully installed accelerate-0.34.2 safetensors-0.4.5\n", "Total images to process: 5\n", "Processing image: briefcase-mantap-FLUXXXX.jpeg\n", "Removing background using bria for image: temp_input\\briefcase-mantap-FLUXXXX.jpeg\n", "Processing image: FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Removing background using bria for image: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Processing image: happy-pamili_flux.png\n", "Removing background using bria for image: temp_input\\happy-pamili_flux.png\n", "Processing image: Luggage-Flux.png\n", "Removing background using bria for image: temp_input\\Luggage-Flux.png\n", "Processing image: SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Removing background using bria for image: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Info for temp_FAMILIAA-LUGGAGE_FLUXX.jpeg: The following sides of the image may contain cropped objects: bottomInfo for temp_SUITCASEE-MAFIOSO-FLUX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "\n", "Info for temp_briefcase-mantap-FLUXXXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Info for temp_happy-pamili_flux.png: The following sides of the image may contain cropped objects: bottom, right\n", "Info for temp_Luggage-Flux.png: The image is not cropped.\n", "Processed image path: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Processed image path: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Processed image path: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Processed image path: processed_images\\happy-pamili_flux.jpg\n", "Processed image path: processed_images\\Luggage-Flux.jpg\n", "Comprehensive log saved to processed_images\\process_log.json\n", "Processing time: 18.62112784385681 seconds\n", "[('processed_images\\\\briefcase-mantap-FLUXXXX.jpg', 'temp_input\\\\briefcase-mantap-FLUXXXX.jpeg'), ('processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg'), ('processed_images\\\\happy-pamili_flux.jpg', 'temp_input\\\\happy-pamili_flux.png'), ('processed_images\\\\Luggage-Flux.jpg', 'temp_input\\\\Luggage-Flux.png'), ('processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg')] | temp_input\\briefcase-mantap-FLUXXXX.jpeg | processed_images\\briefcase-mantap-FLUXXXX.jpg | WATERMARK OBJECT: C:\\Users\\rezau\\AppData\\Local\\Temp\\gradio\\229a0676cb6905c411a225b47d11e523a896602c\\w-watermak.png\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\0c36e4a52c321015f842d060507367460dfcdbcd\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\13d658b462e7dab0b037b6d2c4ff693d9f9b1ffa\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\07509f12d6644deb6b458bc0849e936dd365a315\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\13d658b462e7dab0b037b6d2c4ff693d9f9b1ffa\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\07509f12d6644deb6b458bc0849e936dd365a315\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\210c400a5541913147c7e93ef88501e0419a38d8\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\07509f12d6644deb6b458bc0849e936dd365a315\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\13d658b462e7dab0b037b6d2c4ff693d9f9b1ffa\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\0c36e4a52c321015f842d060507367460dfcdbcd\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\5872026fa880a850c2bb1402dc96f7b5c4ffb3e7\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\0c36e4a52c321015f842d060507367460dfcdbcd\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\13d658b462e7dab0b037b6d2c4ff693d9f9b1ffa\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\07509f12d6644deb6b458bc0849e936dd365a315\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\210c400a5541913147c7e93ef88501e0419a38d8\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\07509f12d6644deb6b458bc0849e936dd365a315\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\13d658b462e7dab0b037b6d2c4ff693d9f9b1ffa\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\5872026fa880a850c2bb1402dc96f7b5c4ffb3e7\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\0c36e4a52c321015f842d060507367460dfcdbcd\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\13d658b462e7dab0b037b6d2c4ff693d9f9b1ffa\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\07509f12d6644deb6b458bc0849e936dd365a315\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\210c400a5541913147c7e93ef88501e0419a38d8\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Total images to process: 5\n", "Processing image: briefcase-mantap-FLUXXXX.jpeg\n", "Removing background using bria for image: temp_input\\briefcase-mantap-FLUXXXX.jpeg\n", "Processing image: FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Removing background using bria for image: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Processing image: happy-pamili_flux.png\n", "Removing background using bria for image: temp_input\\happy-pamili_flux.png\n", "Processing image: Luggage-Flux.png\n", "Removing background using bria for image: temp_input\\Luggage-Flux.png\n", "Processing image: SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Removing background using bria for image: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Info for temp_happy-pamili_flux.png: The following sides of the image may contain cropped objects: bottom, right\n", "Processed image path: processed_images\\happy-pamili_flux.jpg\n", "Info for temp_SUITCASEE-MAFIOSO-FLUX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Info for temp_briefcase-mantap-FLUXXXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Processed image path: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Info for temp_FAMILIAA-LUGGAGE_FLUXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Info for temp_Luggage-Flux.png: The image is not cropped.\n", "Processed image path: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Processed image path: processed_images\\Luggage-Flux.jpg\n", "Comprehensive log saved to processed_images\\process_log.json\n", "Processing time: 16.2646906375885 seconds\n", "[('processed_images\\\\briefcase-mantap-FLUXXXX.jpg', 'temp_input\\\\briefcase-mantap-FLUXXXX.jpeg'), ('processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg'), ('processed_images\\\\happy-pamili_flux.jpg', 'temp_input\\\\happy-pamili_flux.png'), ('processed_images\\\\Luggage-Flux.jpg', 'temp_input\\\\Luggage-Flux.png'), ('processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg')] | temp_input\\briefcase-mantap-FLUXXXX.jpeg | processed_images\\briefcase-mantap-FLUXXXX.jpg | WATERMARK OBJECT: C:\\Users\\rezau\\AppData\\Local\\Temp\\gradio\\229a0676cb6905c411a225b47d11e523a896602c\\w-watermak.png\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\6a1e4d0382b71b7d6f56039b747f5d3e2c030393\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\bf1fb0d474d21f30db3eb5c5a56bed25e150bd77\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\c2e775df4631fefc1fcb53e951e21b40b4568f01\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\a85069b5a4681d5568bbb6e33c85e249c7ed8808\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Total images to process: 5\n", "Processing image: briefcase-mantap-FLUXXXX.jpeg\n", "Removing background using bria for image: temp_input\\briefcase-mantap-FLUXXXX.jpeg\n", "Processing image: FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Removing background using bria for image: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Processing image: happy-pamili_flux.png\n", "Removing background using bria for image: temp_input\\happy-pamili_flux.png\n", "Processing image: Luggage-Flux.png\n", "Removing background using bria for image: temp_input\\Luggage-Flux.png\n", "Processing image: SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Removing background using bria for image: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Info for temp_FAMILIAA-LUGGAGE_FLUXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Info for temp_happy-pamili_flux.png: The following sides of the image may contain cropped objects: bottom, right\n", "Info for temp_SUITCASEE-MAFIOSO-FLUX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\happy-pamili_flux.jpg\n", "Info for temp_briefcase-mantap-FLUXXXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Info for temp_Luggage-Flux.png: The image is not cropped.\n", "Processed image path: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Processed image path: processed_images\\Luggage-Flux.jpg\n", "Comprehensive log saved to processed_images\\process_log.json\n", "Processing time: 17.215789079666138 seconds\n", "[('processed_images\\\\briefcase-mantap-FLUXXXX.jpg', 'temp_input\\\\briefcase-mantap-FLUXXXX.jpeg'), ('processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg'), ('processed_images\\\\happy-pamili_flux.jpg', 'temp_input\\\\happy-pamili_flux.png'), ('processed_images\\\\Luggage-Flux.jpg', 'temp_input\\\\Luggage-Flux.png'), ('processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg')] | temp_input\\briefcase-mantap-FLUXXXX.jpeg | processed_images\\briefcase-mantap-FLUXXXX.jpg | WATERMARK OBJECT: C:\\Users\\rezau\\AppData\\Local\\Temp\\gradio\\229a0676cb6905c411a225b47d11e523a896602c\\w-watermak.png\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\2be78bf8cd9249e7c8259700f656428f3834c3b2\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\de3b8776f9945180082cbfe6b5dd2a23c6a893d2\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\46269a9d0e71e4537f99e566a287a6fe44448485\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\c27f1a5ced5f1612fdc8c00cc0962faa17e5ff1a\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Total images to process: 5\n", "Processing image: briefcase-mantap-FLUXXXX.jpeg\n", "Removing background using bria for image: temp_input\\briefcase-mantap-FLUXXXX.jpeg\n", "Processing image: FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Removing background using bria for image: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Processing image: happy-pamili_flux.png\n", "Removing background using bria for image: temp_input\\happy-pamili_flux.png\n", "Processing image: Luggage-Flux.png\n", "Removing background using bria for image: temp_input\\Luggage-Flux.png\n", "Processing image: SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Removing background using bria for image: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Info for temp_briefcase-mantap-FLUXXXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Info for temp_SUITCASEE-MAFIOSO-FLUX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Info for temp_Luggage-Flux.png: The image is not cropped.\n", "Info for temp_happy-pamili_flux.png: The following sides of the image may contain cropped objects: bottom, right\n", "Processed image path: processed_images\\Luggage-Flux.jpg\n", "Processed image path: processed_images\\happy-pamili_flux.jpg\n", "Info for temp_FAMILIAA-LUGGAGE_FLUXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Comprehensive log saved to processed_images\\process_log.json\n", "Processing time: 15.69490098953247 seconds\n", "[('processed_images\\\\briefcase-mantap-FLUXXXX.jpg', 'temp_input\\\\briefcase-mantap-FLUXXXX.jpeg'), ('processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg'), ('processed_images\\\\happy-pamili_flux.jpg', 'temp_input\\\\happy-pamili_flux.png'), ('processed_images\\\\Luggage-Flux.jpg', 'temp_input\\\\Luggage-Flux.png'), ('processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg')] | temp_input\\briefcase-mantap-FLUXXXX.jpeg | processed_images\\briefcase-mantap-FLUXXXX.jpg | WATERMARK OBJECT: C:\\Users\\rezau\\AppData\\Local\\Temp\\gradio\\229a0676cb6905c411a225b47d11e523a896602c\\w-watermak.png\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\844764c1b70fc63dfec8b978992d08cbc8057dae\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\a487541e7c43f60923736e403e5b77e8e06c1ee5\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\3f81c6eac4d3d6dec1890ab696a07a23bbe85477\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\c68c3e0b608998071cd0ad11da6741a08050eb93\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\16b73f5dfeb7e3d533e32d50292e70259dbe6339\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\844764c1b70fc63dfec8b978992d08cbc8057dae\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Total images to process: 5\n", "Processing image: briefcase-mantap-FLUXXXX.jpeg\n", "Removing background using bria for image: temp_input\\briefcase-mantap-FLUXXXX.jpeg\n", "Processing image: FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Removing background using bria for image: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg\n", "Processing image: happy-pamili_flux.png\n", "Removing background using bria for image: temp_input\\happy-pamili_flux.png\n", "Processing image: Luggage-Flux.png\n", "Removing background using bria for image: temp_input\\Luggage-Flux.png\n", "Processing image: SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Removing background using bria for image: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg\n", "Info for temp_Luggage-Flux.png: The image is not cropped.\n", "Processed image path: processed_images\\Luggage-Flux.jpg\n", "Info for temp_SUITCASEE-MAFIOSO-FLUX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Info for temp_FAMILIAA-LUGGAGE_FLUXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Info for temp_briefcase-mantap-FLUXXXX.jpeg: The following sides of the image may contain cropped objects: bottom\n", "Processed image path: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Info for temp_happy-pamili_flux.png: The following sides of the image may contain cropped objects: bottom, right\n", "Processed image path: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Processed image path: processed_images\\happy-pamili_flux.jpg\n", "Comprehensive log saved to processed_images\\process_log.json\n", "Processing time: 15.257786750793457 seconds\n", "[('processed_images\\\\briefcase-mantap-FLUXXXX.jpg', 'temp_input\\\\briefcase-mantap-FLUXXXX.jpeg'), ('processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg'), ('processed_images\\\\happy-pamili_flux.jpg', 'temp_input\\\\happy-pamili_flux.png'), ('processed_images\\\\Luggage-Flux.jpg', 'temp_input\\\\Luggage-Flux.png'), ('processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg')] | temp_input\\briefcase-mantap-FLUXXXX.jpeg | processed_images\\briefcase-mantap-FLUXXXX.jpg | WATERMARK OBJECT: None\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\47112f33583625ee752d4d240833fb3498da3795\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\ff1963a32f160886f25833f4e1c12a5831fe9bba\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\83bec9ecc3dbbd0647be267dc1f977b831418280\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\01ce046b41ddbb4e0372e935b843a038235e28f5\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\c6aa7df1749d0c0b821a54ba72bba4a9a327fc40\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\01ce046b41ddbb4e0372e935b843a038235e28f5\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\83bec9ecc3dbbd0647be267dc1f977b831418280\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\ff1963a32f160886f25833f4e1c12a5831fe9bba\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\47112f33583625ee752d4d240833fb3498da3795\\\\SUITCASEE-MAFIOSO-FLUX.jpg', 'processed_images\\\\SUITCASEE-MAFIOSO-FLUX.jpg|temp_input\\\\SUITCASEE-MAFIOSO-FLUX.jpeg']\n", "Successfully processed. Input: temp_input\\SUITCASEE-MAFIOSO-FLUX.jpeg, Output: processed_images\\SUITCASEE-MAFIOSO-FLUX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\ff1963a32f160886f25833f4e1c12a5831fe9bba\\\\Luggage-Flux.jpg', 'processed_images\\\\Luggage-Flux.jpg|temp_input\\\\Luggage-Flux.png']\n", "Successfully processed. Input: temp_input\\Luggage-Flux.png, Output: processed_images\\Luggage-Flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\83bec9ecc3dbbd0647be267dc1f977b831418280\\\\happy-pamili_flux.jpg', 'processed_images\\\\happy-pamili_flux.jpg|temp_input\\\\happy-pamili_flux.png']\n", "Successfully processed. Input: temp_input\\happy-pamili_flux.png, Output: processed_images\\happy-pamili_flux.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\01ce046b41ddbb4e0372e935b843a038235e28f5\\\\FAMILIAA-LUGGAGE_FLUXX.jpg', 'processed_images\\\\FAMILIAA-LUGGAGE_FLUXX.jpg|temp_input\\\\FAMILIAA-LUGGAGE_FLUXX.jpeg']\n", "Successfully processed. Input: temp_input\\FAMILIAA-LUGGAGE_FLUXX.jpeg, Output: processed_images\\FAMILIAA-LUGGAGE_FLUXX.jpg\n", "Selected value: ['http://127.0.0.1:7922/file=C:\\\\Users\\\\rezau\\\\AppData\\\\Local\\\\Temp\\\\gradio\\\\c6aa7df1749d0c0b821a54ba72bba4a9a327fc40\\\\briefcase-mantap-FLUXXXX.jpg', 'processed_images\\\\briefcase-mantap-FLUXXXX.jpg|temp_input\\\\briefcase-mantap-FLUXXXX.jpeg']\n", "Successfully processed. Input: temp_input\\briefcase-mantap-FLUXXXX.jpeg, Output: processed_images\\briefcase-mantap-FLUXXXX.jpg\n" ] } ], "source": [ "!pip install accelerate" ] }, { "cell_type": "code", "execution_count": 230, "id": "73120aef-e9d2-4948-b041-4df254e3b242", "metadata": { "tags": [] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Cannot initialize model with low cpu memory usage because `accelerate` was not found in the environment. Defaulting to `low_cpu_mem_usage=False`. It is strongly recommended to install `accelerate` for faster and less memory-intense model loading. You can do so with: \n", "```\n", "pip install accelerate\n", "```\n", ".\n" ] }, { "ename": "GatedRepoError", "evalue": "401 Client Error. (Request ID: Root=1-66ec93a8-353dd7c95570061e5471e935;7242157e-77c9-4e08-910b-82080d6f93d6)\n\nCannot access gated repo for url https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/model_index.json.\nAccess to model black-forest-labs/FLUX.1-dev is restricted. You must have access to it and be authenticated to access it. Please log in.", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mHTTPError\u001b[0m Traceback (most recent call last)", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\utils\\_errors.py:304\u001b[0m, in \u001b[0;36mhf_raise_for_status\u001b[1;34m(response, endpoint_name)\u001b[0m\n\u001b[0;32m 303\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 304\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 305\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m HTTPError \u001b[38;5;28;01mas\u001b[39;00m e:\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\requests\\models.py:1024\u001b[0m, in \u001b[0;36mResponse.raise_for_status\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1023\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m http_error_msg:\n\u001b[1;32m-> 1024\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m HTTPError(http_error_msg, response\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m)\n", "\u001b[1;31mHTTPError\u001b[0m: 401 Client Error: Unauthorized for url: https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/model_index.json", "\nThe above exception was the direct cause of the following exception:\n", "\u001b[1;31mGatedRepoError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[230], line 4\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mtorch\u001b[39;00m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdiffusers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m FluxPipeline\n\u001b[1;32m----> 4\u001b[0m pipe \u001b[38;5;241m=\u001b[39m \u001b[43mFluxPipeline\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_pretrained\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mblack-forest-labs/FLUX.1-dev\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtorch_dtype\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtorch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbfloat16\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 5\u001b[0m pipe\u001b[38;5;241m.\u001b[39menable_model_cpu_offload() \u001b[38;5;66;03m#save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power\u001b[39;00m\n\u001b[0;32m 7\u001b[0m prompt \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mA cat holding a sign that says hello world\u001b[39m\u001b[38;5;124m\"\u001b[39m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\utils\\_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.._inner_fn\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[0;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[1;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\diffusers\\pipelines\\pipeline_utils.py:699\u001b[0m, in \u001b[0;36mDiffusionPipeline.from_pretrained\u001b[1;34m(cls, pretrained_model_name_or_path, **kwargs)\u001b[0m\n\u001b[0;32m 694\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m pretrained_model_name_or_path\u001b[38;5;241m.\u001b[39mcount(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[0;32m 695\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[0;32m 696\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mThe provided pretrained_model_name_or_path \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mpretrained_model_name_or_path\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m 697\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m is neither a valid local path nor a valid repo id. Please check the parameter.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 698\u001b[0m )\n\u001b[1;32m--> 699\u001b[0m cached_folder \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdownload\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 700\u001b[0m \u001b[43m \u001b[49m\u001b[43mpretrained_model_name_or_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 701\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 702\u001b[0m \u001b[43m \u001b[49m\u001b[43mforce_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mforce_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 703\u001b[0m \u001b[43m \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 704\u001b[0m \u001b[43m \u001b[49m\u001b[43mlocal_files_only\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlocal_files_only\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 705\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 706\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 707\u001b[0m \u001b[43m \u001b[49m\u001b[43mfrom_flax\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfrom_flax\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 708\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_safetensors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_safetensors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 709\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_onnx\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_onnx\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 710\u001b[0m \u001b[43m \u001b[49m\u001b[43mcustom_pipeline\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcustom_pipeline\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 711\u001b[0m \u001b[43m \u001b[49m\u001b[43mcustom_revision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcustom_revision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 712\u001b[0m \u001b[43m \u001b[49m\u001b[43mvariant\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvariant\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 713\u001b[0m \u001b[43m \u001b[49m\u001b[43mload_connected_pipeline\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mload_connected_pipeline\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 714\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 715\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 716\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 717\u001b[0m cached_folder \u001b[38;5;241m=\u001b[39m pretrained_model_name_or_path\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\utils\\_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.._inner_fn\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[0;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[1;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\diffusers\\pipelines\\pipeline_utils.py:1298\u001b[0m, in \u001b[0;36mDiffusionPipeline.download\u001b[1;34m(cls, pretrained_model_name, **kwargs)\u001b[0m\n\u001b[0;32m 1295\u001b[0m model_info_call_error \u001b[38;5;241m=\u001b[39m e \u001b[38;5;66;03m# save error to reraise it if model is not cached locally\u001b[39;00m\n\u001b[0;32m 1297\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m local_files_only:\n\u001b[1;32m-> 1298\u001b[0m config_file \u001b[38;5;241m=\u001b[39m \u001b[43mhf_hub_download\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1299\u001b[0m \u001b[43m \u001b[49m\u001b[43mpretrained_model_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1300\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mcls\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconfig_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1301\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1302\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1303\u001b[0m \u001b[43m \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1304\u001b[0m \u001b[43m \u001b[49m\u001b[43mforce_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mforce_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1305\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1306\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1308\u001b[0m config_dict \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m_dict_from_json_file(config_file)\n\u001b[0;32m 1309\u001b[0m ignore_filenames \u001b[38;5;241m=\u001b[39m config_dict\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m_ignore_files\u001b[39m\u001b[38;5;124m\"\u001b[39m, [])\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\utils\\_deprecation.py:101\u001b[0m, in \u001b[0;36m_deprecate_arguments.._inner_deprecate_positional_args..inner_f\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 99\u001b[0m message \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m custom_message\n\u001b[0;32m 100\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(message, \u001b[38;5;167;01mFutureWarning\u001b[39;00m)\n\u001b[1;32m--> 101\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mf\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\utils\\_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.._inner_fn\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[0;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[1;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\file_download.py:1240\u001b[0m, in \u001b[0;36mhf_hub_download\u001b[1;34m(repo_id, filename, subfolder, repo_type, revision, library_name, library_version, cache_dir, local_dir, user_agent, force_download, proxies, etag_timeout, token, local_files_only, headers, endpoint, legacy_cache_layout, resume_download, force_filename, local_dir_use_symlinks)\u001b[0m\n\u001b[0;32m 1220\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _hf_hub_download_to_local_dir(\n\u001b[0;32m 1221\u001b[0m \u001b[38;5;66;03m# Destination\u001b[39;00m\n\u001b[0;32m 1222\u001b[0m local_dir\u001b[38;5;241m=\u001b[39mlocal_dir,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1237\u001b[0m local_files_only\u001b[38;5;241m=\u001b[39mlocal_files_only,\n\u001b[0;32m 1238\u001b[0m )\n\u001b[0;32m 1239\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1240\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_hf_hub_download_to_cache_dir\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1241\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# Destination\u001b[39;49;00m\n\u001b[0;32m 1242\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1243\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# File info\u001b[39;49;00m\n\u001b[0;32m 1244\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1245\u001b[0m \u001b[43m \u001b[49m\u001b[43mfilename\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfilename\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1246\u001b[0m \u001b[43m \u001b[49m\u001b[43mrepo_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_type\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1247\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1248\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# HTTP info\u001b[39;49;00m\n\u001b[0;32m 1249\u001b[0m \u001b[43m \u001b[49m\u001b[43mendpoint\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mendpoint\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1250\u001b[0m \u001b[43m \u001b[49m\u001b[43metag_timeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43metag_timeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1251\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1252\u001b[0m \u001b[43m \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1253\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1254\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# Additional options\u001b[39;49;00m\n\u001b[0;32m 1255\u001b[0m \u001b[43m \u001b[49m\u001b[43mlocal_files_only\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlocal_files_only\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1256\u001b[0m \u001b[43m \u001b[49m\u001b[43mforce_download\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mforce_download\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1257\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\file_download.py:1347\u001b[0m, in \u001b[0;36m_hf_hub_download_to_cache_dir\u001b[1;34m(cache_dir, repo_id, filename, repo_type, revision, endpoint, etag_timeout, headers, proxies, token, local_files_only, force_download)\u001b[0m\n\u001b[0;32m 1344\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m pointer_path\n\u001b[0;32m 1346\u001b[0m \u001b[38;5;66;03m# Otherwise, raise appropriate error\u001b[39;00m\n\u001b[1;32m-> 1347\u001b[0m \u001b[43m_raise_on_head_call_error\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhead_call_error\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mforce_download\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlocal_files_only\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1349\u001b[0m \u001b[38;5;66;03m# From now on, etag, commit_hash, url and size are not None.\u001b[39;00m\n\u001b[0;32m 1350\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m etag \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124metag must have been retrieved from server\u001b[39m\u001b[38;5;124m\"\u001b[39m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\file_download.py:1855\u001b[0m, in \u001b[0;36m_raise_on_head_call_error\u001b[1;34m(head_call_error, force_download, local_files_only)\u001b[0m\n\u001b[0;32m 1849\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LocalEntryNotFoundError(\n\u001b[0;32m 1850\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1851\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m hf.co look-ups and downloads online, set \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlocal_files_only\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m to False.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1852\u001b[0m )\n\u001b[0;32m 1853\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(head_call_error, RepositoryNotFoundError) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(head_call_error, GatedRepoError):\n\u001b[0;32m 1854\u001b[0m \u001b[38;5;66;03m# Repo not found or gated => let's raise the actual error\u001b[39;00m\n\u001b[1;32m-> 1855\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m head_call_error\n\u001b[0;32m 1856\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 1857\u001b[0m \u001b[38;5;66;03m# Otherwise: most likely a connection issue or Hub downtime => let's warn the user\u001b[39;00m\n\u001b[0;32m 1858\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LocalEntryNotFoundError(\n\u001b[0;32m 1859\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAn error happened while trying to locate the file on the Hub and we cannot find the requested files\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1860\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m in the local cache. Please check your connection and try again or make sure your Internet connection\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1861\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m is on.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1862\u001b[0m ) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mhead_call_error\u001b[39;00m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\file_download.py:1752\u001b[0m, in \u001b[0;36m_get_metadata_or_catch_error\u001b[1;34m(repo_id, filename, repo_type, revision, endpoint, proxies, etag_timeout, headers, token, local_files_only, relative_filename, storage_folder)\u001b[0m\n\u001b[0;32m 1750\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 1751\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m-> 1752\u001b[0m metadata \u001b[38;5;241m=\u001b[39m \u001b[43mget_hf_file_metadata\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1753\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43metag_timeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\n\u001b[0;32m 1754\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1755\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m EntryNotFoundError \u001b[38;5;28;01mas\u001b[39;00m http_error:\n\u001b[0;32m 1756\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m storage_folder \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m relative_filename \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 1757\u001b[0m \u001b[38;5;66;03m# Cache the non-existence of the file\u001b[39;00m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\utils\\_validators.py:114\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.._inner_fn\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 111\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[0;32m 112\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[1;32m--> 114\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\file_download.py:1674\u001b[0m, in \u001b[0;36mget_hf_file_metadata\u001b[1;34m(url, token, proxies, timeout, library_name, library_version, user_agent, headers)\u001b[0m\n\u001b[0;32m 1671\u001b[0m headers[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAccept-Encoding\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124midentity\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;66;03m# prevent any compression => we want to know the real size of the file\u001b[39;00m\n\u001b[0;32m 1673\u001b[0m \u001b[38;5;66;03m# Retrieve metadata\u001b[39;00m\n\u001b[1;32m-> 1674\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43m_request_wrapper\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 1675\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mHEAD\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1676\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1677\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1678\u001b[0m \u001b[43m \u001b[49m\u001b[43mallow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[0;32m 1679\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_relative_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[0;32m 1680\u001b[0m \u001b[43m \u001b[49m\u001b[43mproxies\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1681\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 1682\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1683\u001b[0m hf_raise_for_status(r)\n\u001b[0;32m 1685\u001b[0m \u001b[38;5;66;03m# Return\u001b[39;00m\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\file_download.py:376\u001b[0m, in \u001b[0;36m_request_wrapper\u001b[1;34m(method, url, follow_relative_redirects, **params)\u001b[0m\n\u001b[0;32m 374\u001b[0m \u001b[38;5;66;03m# Recursively follow relative redirects\u001b[39;00m\n\u001b[0;32m 375\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m follow_relative_redirects:\n\u001b[1;32m--> 376\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43m_request_wrapper\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 377\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 378\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 379\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_relative_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[0;32m 380\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 381\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 383\u001b[0m \u001b[38;5;66;03m# If redirection, we redirect only relative paths.\u001b[39;00m\n\u001b[0;32m 384\u001b[0m \u001b[38;5;66;03m# This is useful in case of a renamed repository.\u001b[39;00m\n\u001b[0;32m 385\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;241m300\u001b[39m \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39mstatus_code \u001b[38;5;241m<\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m399\u001b[39m:\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\file_download.py:400\u001b[0m, in \u001b[0;36m_request_wrapper\u001b[1;34m(method, url, follow_relative_redirects, **params)\u001b[0m\n\u001b[0;32m 398\u001b[0m \u001b[38;5;66;03m# Perform request and return if status_code is not in the retry list.\u001b[39;00m\n\u001b[0;32m 399\u001b[0m response \u001b[38;5;241m=\u001b[39m get_session()\u001b[38;5;241m.\u001b[39mrequest(method\u001b[38;5;241m=\u001b[39mmethod, url\u001b[38;5;241m=\u001b[39murl, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mparams)\n\u001b[1;32m--> 400\u001b[0m \u001b[43mhf_raise_for_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 401\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n", "File \u001b[1;32m~\\anaconda3\\envs\\ai-sensum\\Lib\\site-packages\\huggingface_hub\\utils\\_errors.py:321\u001b[0m, in \u001b[0;36mhf_raise_for_status\u001b[1;34m(response, endpoint_name)\u001b[0m\n\u001b[0;32m 317\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m error_code \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mGatedRepo\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m 318\u001b[0m message \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m 319\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse\u001b[38;5;241m.\u001b[39mstatus_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m Client Error.\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCannot access gated repo for url \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse\u001b[38;5;241m.\u001b[39murl\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 320\u001b[0m )\n\u001b[1;32m--> 321\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m GatedRepoError(message, response) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[0;32m 323\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m error_message \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAccess to this resource is disabled.\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m 324\u001b[0m message \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m 325\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse\u001b[38;5;241m.\u001b[39mstatus_code\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m Client Error.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 326\u001b[0m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 329\u001b[0m \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAccess to this resource is disabled.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 330\u001b[0m )\n", "\u001b[1;31mGatedRepoError\u001b[0m: 401 Client Error. (Request ID: Root=1-66ec93a8-353dd7c95570061e5471e935;7242157e-77c9-4e08-910b-82080d6f93d6)\n\nCannot access gated repo for url https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/model_index.json.\nAccess to model black-forest-labs/FLUX.1-dev is restricted. You must have access to it and be authenticated to access it. Please log in." ] } ], "source": [ "import torch\n", "from diffusers import FluxPipeline\n", "\n", "pipe = FluxPipeline.from_pretrained(\"black-forest-labs/FLUX.1-dev\", torch_dtype=torch.bfloat16)\n", "pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power\n", "\n", "prompt = \"A cat holding a sign that says hello world\"\n", "image = pipe(\n", " prompt,\n", " height=1024,\n", " width=1024,\n", " guidance_scale=3.5,\n", " num_inference_steps=50,\n", " max_sequence_length=512,\n", " generator=torch.Generator(\"cpu\").manual_seed(0)\n", ").images[0]\n", "image.save(\"flux-dev.png\")" ] } ], "metadata": { "kernelspec": { "display_name": "ai-sensum", "language": "python", "name": "ai-sensum" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 5 }