python_jpeg.py 833 B

12345678910111213141516
  1. from evaluator import *
  2. DESCRIPTION = "Test if a model can write a program that directly writes a jpeg file. This requires precise understanding of the jpeg spec."
  3. TAGS = ['code', 'python', 'visual']
  4. question = """
  5. Write a python program that, manually, draws a red triangle on a white background and saves it as a 200x200 gif file. Do not use any graphics libraries. Write the gif byte by byte. Output the gif file to stdout.
  6. I will evaluate your program by running `python your_soln.py > /tmp/a.gif` and then view the output file.
  7. """
  8. TestFlagDraw = question >> LLMRun() >> ExtractCode(keep_main=True) >> PythonRun(out_bytes=True) >> LLMVisionRun("Describe the shapes in this image and their color") >> (SubstringEvaluator("triangle") & SubstringEvaluator("red"))
  9. if __name__ == "__main__":
  10. print(run_test(TestFlagDraw))