benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf afc7b361-52b9-5b33-80bf-14b1aaeee5ae

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

from PIL import Image, ImageFilter
import cv2
import numpy as np
import os

def task_func(img_path, blur_radius=5):
    """
    Open an RGB image from a specific path, apply a blur filter, convert it to grayscale, and then display both the original and the edited images side by side.
    Returns numpy arrays representing both the original and the processed images.

    Parameters:
    - img_path (str): The path of the image file.
    - blur_radius (int): The radius of the Gaussian blur filter. Default is 5.

    Returns:
    - tuple: A tuple containing two numpy arrays, the first representing the original image and 
             the second representing the blurred and grayscaled image.

    Raises:
    - FileNotFoundError: If the image file does not exist at the specified path.

    Requirements:
    - PIL
    - opencv-python
    - numpy
    - os

    Example:
    >>> image_path = 'sample.png'
    >>> create_dummy_image(image_path=image_path)
    >>> original, processed = task_func(image_path)
    >>> os.remove(image_path)
    """

instruct prompt

Open an RGB image from a specific path, apply a blur filter, convert it to grayscale, and then display both the original and the edited images side by side. Returns numpy arrays representing both the original and the processed images.
The function should raise the exception for: FileNotFoundError: If the image file does not exist at the specified path.
The function should output with:
    tuple: A tuple containing two numpy arrays, the first representing the original image and
    the second representing the blurred and grayscaled image.
You should write self-contained code starting with:

Code

from PIL import Image, ImageFilter
import cv2
import numpy as np
import os
def task_func(img_path, blur_radius=5):

code prompt

Code

from PIL import Image, ImageFilter
import cv2
import numpy as np
import os
def task_func(img_path, blur_radius=5):

entry point

task_func

libs

  • cv2
  • numpy
  • PIL
  • os

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import