do one thing give me with this script 
import os
import re
import cv2
import pandas as pd
import numpy as np
import easyocr
from PIL import Image
import logging
from tqdm import tqdm

# Configure logging
logging.basicConfig(
    filename='ocr_pipeline_part1.log',
    filemode='a',
    format='%(asctime)s - %(levelname)s - %(message)s',
    level=logging.INFO
)

# Initialize EasyOCR reader
reader = easyocr.Reader(['en'], gpu=True)  # GPU option

# ------------------------------
# Configuration and Mappings
# ------------------------------

# Entity to allowed units mapping
entity_allowed_units = {
    'width': {'centimetre', 'foot', 'inch', 'metre', 'millimetre', 'yard'},
    'depth': {'centimetre', 'foot', 'inch', 'metre', 'millimetre', 'yard'},
    'height': {'centimetre', 'foot', 'inch', 'metre', 'millimetre', 'yard'},
    'item_weight': {'gram', 'kilogram', 'microgram', 'milligram', 'ounce', 'pound', 'ton'},
    'maximum_weight_recommendation': {'gram', 'kilogram', 'microgram', 'milligram', 'ounce', 'pound', 'ton'},
    'voltage': {'kilovolt', 'millivolt', 'volt'},
    'wattage': {'kilowatt', 'watt'},
    'item_volume': {'centilitre', 'cubic foot', 'cubic inch', 'cup', 'decilitre', 'fluid ounce', 'gallon',
                    'imperial gallon', 'litre', 'microlitre', 'millilitre', 'pint', 'quart'}
}

# Unit normalization mapping
unit_normalization_map = {
    # Length units
    'cm': 'centimetre', 'centimeter': 'centimetre', 'centimetres': 'centimetre', 'centimeters': 'centimetre',
    'm': 'metre', 'meter': 'metre', 'metres': 'metre', 'meters': 'metre',
    'mm': 'millimetre', 'millimeter': 'millimetre', 'millimetres': 'millimetre', 'millimeters': 'millimetre',
    'ft': 'foot', 'feet': 'foot', 'foot': 'foot',
    'in': 'inch', 'inch': 'inch', 'inches': 'inch',
    'yd': 'yard', 'yard': 'yard', 'yards': 'yard',

    # Weight units
    'g': 'gram', 'gram': 'gram', 'grams': 'gram',
    'kg': 'kilogram', 'kilogram': 'kilogram', 'kilograms': 'kilogram',
    'mg': 'milligram', 'milligram': 'milligram', 'milligrams': 'milligram',
    'μg': 'microgram', 'microgram': 'microgram', 'micrograms': 'microgram',
    'lb': 'pound', 'lbs': 'pound', 'pound': 'pound', 'pounds': 'pound',
    'oz': 'ounce', 'ounce': 'ounce', 'ounces': 'ounce',
    'ton': 'ton', 'tons': 'ton',

    # Voltage units
    'kv': 'kilovolt', 'kilovolt': 'kilovolt', 'kilovolts': 'kilovolt',
    'mv': 'millivolt', 'millivolt': 'millivolt', 'millivolts': 'millivolt',
    'v': 'volt', 'volt': 'volt', 'volts': 'volt',

    # Wattage units
    'kw': 'kilowatt', 'kilowatt': 'kilowatt', 'kilowatts': 'kilowatt',
    'w': 'watt', 'watt': 'watt', 'watts': 'watt',

    # Volume units
    'l': 'litre', 'liter': 'litre', 'litre': 'litre', 'liters': 'litre', 'litres': 'litre',
    'ml': 'millilitre', 'millilitre': 'millilitre', 'milliliter': 'millilitre', 'milliliters': 'millilitre', 'millilitres': 'millilitre',
    'cl': 'centilitre', 'centilitre': 'centilitre', 'centiliter': 'centilitre', 'centiliters': 'centilitre', 'centilitres': 'centilitre',
    'dl': 'decilitre', 'decilitre': 'decilitre', 'deciliter': 'decilitre', 'deciliters': 'decilitre', 'decilitres': 'decilitre',
    'μl': 'microlitre', 'microlitre': 'microlitre', 'microliter': 'microlitre', 'microliters': 'microlitre', 'microlitres': 'microlitre',
    'gal': 'gallon', 'gallon': 'gallon', 'gallons': 'gallon',
    'cup': 'cup', 'cups': 'cup',
    'pt': 'pint', 'pint': 'pint', 'pints': 'pint',
    'qt': 'quart', 'quart': 'quart', 'quarts': 'quart',
    'fl oz': 'fluid ounce', 'fluid ounce': 'fluid ounce', 'fluid ounces': 'fluid ounce',
    'cu ft': 'cubic foot', 'cubic foot': 'cubic foot', 'cubic feet': 'cubic foot',
    'cu in': 'cubic inch', 'cubic inch': 'cubic inch', 'cubic inches': 'cubic inch',
    'imperial gallon': 'imperial gallon', 'imperial gallons': 'imperial gallon',
}

# Allowed units set
allowed_units = set()
for units in entity_allowed_units.values():
    allowed_units.update(units)

# Entity keywords for identification
entity_keywords = {
    'width': ['width', 'breadth', 'wide'],
    'depth': ['depth'],
    'height': ['height', 'length'],
    'item_weight': ['weight', 'wt'],
    'maximum_weight_recommendation': ['maximum weight', 'recommended weight', 'max weight', 'max wt', 'maximum wt'],
    'voltage': ['voltage', 'volt'],
    'wattage': ['wattage', 'watt'],
    'item_volume': ['capacity', 'volume', 'size']
}

# ------------------------------
# Helper Functions
# ------------------------------

def normalize_unit(unit):
    unit = unit.lower().strip()
    normalized_unit = unit_normalization_map.get(unit, unit)
    if normalized_unit in allowed_units:
        return normalized_unit
    else:
        return None

def preprocess_image(img, max_size=1024):
    """
    Resize image if the largest dimension exceeds max_size.
    """
    height, width = img.shape[:2]
    if max(height, width) > max_size:
        scaling_factor = max_size / float(max(height, width))
        img = cv2.resize(img, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
    return img

def extract_numerical_values(text, entity):
    """
    Extract numerical values and their units based on the entity.
    """
    units = entity_allowed_units.get(entity, set())
    if not units:
        return []

    # Expand units to include abbreviations
    all_units = units.copy()
    for unit in units:
        for abbr, full_unit in unit_normalization_map.items():
            if full_unit == unit:
                all_units.add(abbr)

    # Escape units that have special regex characters
    units_escaped = [re.escape(u) for u in all_units]
    # Pattern to match numbers followed (optionally) by space and then unit
    pattern = r'(\d+(?:.\d+)?)\s*(' + '|'.join(units_escaped) + r')\b'
    matches = re.findall(pattern, text, re.IGNORECASE)

    results = []
    for match in matches:
        number_str = match[0]
        unit = match[1]
        # Normalize unit
        normalized_unit = normalize_unit(unit)
        if normalized_unit:
            try:
                number = float(number_str)
                results.append((number, normalized_unit))
            except ValueError:
                continue  # Skip invalid numbers
    return results

def extract_dimensions_pattern(text):
    """
    Extract dimensions if present in the format 'L x W x H unit'.
    """
    # Pattern to match something like '12 x 10 x 5 cm' or '12x10x5cm'
    pattern = r'(\d+(?:.\d+)?)\sx\s(\d+(?:.\d+)?)\sx\s(\d+(?:.\d+)?)\s*([a-zA-Z]+)'
    matches = re.findall(pattern, text, re.IGNORECASE)
    results = {}
    if matches:
        for match in matches:
            length_value = float(match[0])
            width_value = float(match[1])
            height_value = float(match[2])
            unit = match[3]
            normalized_unit = normalize_unit(unit)
            if normalized_unit:
                results['length'] = (length_value, normalized_unit)
                results['width'] = (width_value, normalized_unit)
                results['height'] = (height_value, normalized_unit)
                break  # Assume only one set of dimensions needed
    return results

def extract_entity_values(text, query_entities):
    """
    Extract values for the specified entities from the given text.
    """
    entity_matches = {entity: [] for entity in query_entities}

    # Extract dimension patterns first
    dimension_matches = extract_dimensions_pattern(text)
    if dimension_matches:
        for entity in query_entities:
            if entity in dimension_matches:
                entity_matches[entity].append(dimension_matches[entity])

    # Extract based on keywords
    for entity in query_entities:
        if not entity_matches[entity]:
            # Search for keywords
            keywords = entity_keywords.get(entity, [])
            for keyword in keywords:
                # Look for the keyword and a number nearby
                pattern = r'\b' + re.escape(keyword) + r'\b.{0,20}?(\d+(?:.\d+)?)(?:\s*([a-zA-Z]+))?'
                matches = re.findall(pattern, text, re.IGNORECASE)
                if matches:
                    for match in matches:
                        number_str = match[0]
                        unit = match[1] if len(match) > 1 else ''
                        normalized_unit = normalize_unit(unit) if unit else ''
                        if normalized_unit or not unit:
                            try:
                                number = float(number_str)
                                if normalized_unit:
                                    entity_matches[entity].append((number, normalized_unit))
                                else:
                                    # No unit found, append without unit
                                    entity_matches[entity].append((number, ''))
                            except ValueError:
                                continue

    # General number and unit extraction if still not found
    for entity in query_entities:
        if not entity_matches[entity]:
            numerical_values = extract_numerical_values(text, entity)
            if numerical_values:
                entity_matches[entity].extend(numerical_values)

    return entity_matches

def ocr_extract_entities(img_path, query_entities):
    """
    Perform OCR on the image data and extract specified entities.
    """
    try:
        # Read image from disk
        img = cv2.imread(img_path)
        if img is None:
            logging.warning(f"Could not read image {img_path}")
            return {entity: [] for entity in query_entities}

        img = preprocess_image(img)

        # Convert image to RGB (needed for EasyOCR)
        img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

        # Perform OCR using EasyOCR
        result = reader.readtext(img, detail=0, paragraph=True)
        text = ' '.join(result)

        # Extract entities from text
        extracted_entities = extract_entity_values(text, query_entities)
        return extracted_entities
    except Exception as e:
        logging.error(f"OCR extraction failed for {img_path}: {e}")
        return {entity: [] for entity in query_entities}

# ------------------------------
# Main Processing Function
# ------------------------------

def main():
    # Paths
    test_csv_path = '/kaggle/input/testfile/test.csv'  # Update with your actual path
    images_folder = '/kaggle/input/the-dataset/images/test'  # Update with your actual path
    output_file = 'output_part1.csv'

    # Load test data
    df = pd.read_csv(test_csv_path)
    logging.info(f"Loaded {len(df)} entries from test.csv")

    # Define start and end row indices for this part
    start_row = 0
    end_row = 43728  # Inclusive

    # Select the subset of data
    df_part = df.iloc[start_row:end_row+1].reset_index(drop=True)
    logging.info(f"Processing rows from {start_row} to {end_row}")

    # Proceed with the rest of the code as before, but use df_part instead of df
    # Initialize cache for images already processed
    ocr_cache = {}

    # Prepare output
    output_list = []

    # For progress bar
    total = len(df_part)

    # Process each entry
    for idx, row in tqdm(df_part.iterrows(), total=total):
        index = row['index']
        image_link = row['image_link']
        entity_name = row['entity_name']

        # The image filename is the last part of the URL
        image_filename = os.path.basename(image_link)
        image_path = os.path.join(images_folder, image_filename)

        # Check if the image has already been processed
        if image_filename in ocr_cache:
            extracted_entities = ocr_cache[image_filename]
        else:
            # Perform OCR and extract entities
            extracted_entities = ocr_extract_entities(image_path, [entity_name])
            # Cache the result
            ocr_cache[image_filename] = extracted_entities

        # Get the prediction for the entity
        entity_values = extracted_entities.get(entity_name, [])

        if entity_values:
            # Select the first extracted value with unit
            prediction = ''
            for number, unit in entity_values:
                if unit:
                    # Format number without commas
                    if float(number).is_integer():
                        number_formatted = f"{int(number)}"
                    else:
                        number_formatted = f"{number:.2f}".rstrip('0').rstrip('.')
                    prediction = f"{number_formatted} {unit}"
                    break  # Use first valid prediction with unit
        else:
            prediction = ""

        # Append to output
        output_list.append({'index': index, 'prediction': prediction})

    # Create output DataFrame
    output_df = pd.DataFrame(output_list)
    # Ensure that we have predictions for all indices in df_part
    output_df = output_df.set_index('index')
    output_df = output_df.reindex(df_part['index'])
    output_df = output_df.reset_index()

    # Save to CSV
    output_df.to_csv(output_file, index=False)

    logging.info(f"Processing completed. Results saved to {output_file}")

if __name__ == "__main__":
    main()

i want to test it so i'll use a input of 100 images
but the images aren't downloaded so please give me a script that processes images from the csv links downloades it 
with same accuracy and stuff