benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 58e3c444-80ed-552a-8b2e-b02b77c34f6f

Problem

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

complete prompt

from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os

def task_func(img_path, angle):
    """
    Open an image, rotate it around a certain angle, and then display both the original and the rotated images side by side. 
    Additionally, return both images as numpy arrays.

    Parameters:
    img_path (str): The path of the image file.
    angle (float): The angle to rotate the image (in degrees).

    Returns:
    tuple: A tuple containing two numpy arrays, the first representing the original image and 
           the second representing the rotated image. Expands the rotated image to make it large enough to hold the entire rotated image.

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

    Requirements:
    - PIL
    - matplotlib
    - numpy
    - os

    Example:
    >>> img_path = 'sample.png'
    >>> create_dummy_image(image_path=img_path)
    >>> original_img_array, rotated_img_array = task_func(img_path, 45)
    >>> os.remove(img_path)
    """

instruct prompt

Open an image, rotate it around a certain angle, and then display both the original and the rotated images side by side. Additionally, return both images as numpy arrays.
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 rotated image. Expands the rotated image to make it large enough to hold the entire rotated image.
You should write self-contained code starting with:

Code

from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os
def task_func(img_path, angle):

code prompt

Code

from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os
def task_func(img_path, angle):

entry point

task_func

libs

  • numpy
  • matplotlib
  • 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