gpt-3.5-turbo-0613· OpenAI
Arena Human Preference 55K
Can you create python code that generates a svg image of a unicorn using swgwrite?
- User
Can you create python code that generates a svg image of a unicorn using swgwrite?
- Assistant
Certainly! Here's an example of Python code that uses the
svgwritelibrary to generate an SVG image of a unicorn:import svgwrite def draw_unicorn(): dwg = svgwrite.Drawing('unicorn.svg', profile='tiny') # Draw the unicorn's body body = dwg.add(dwg.g()) body.add(dwg.ellipse(center=(300, 400), r=(120, 150), fill='white', stroke='black')) # Draw the unicorn's head head = dwg.add(dwg.g()) head.add(dwg.ellipse(center=(300, 270), r=(90, 100), fill='white', stroke='black')) # Draw the unicorn's horn horn = dwg.add(dwg.g()) horn.add(dwg.polygon(points=[(300, 150), (320, 200), (280, 200)], fill='gold', stroke='black')) # Draw the unicorn's eyes eyes = dwg.add(dwg.g()) eyes.add(dwg.circle(center=(280, 250), r=10, fill='black')) eyes.add(dwg.circle(center=(320, 250), r=10, fill='black')) # Draw the unicorn's mane mane = dwg.add(dwg.g()) mane.add(dwg.polygon(points=[(240, 300), (280, 200), (320, 200), (360, 300)], fill='pink', stroke='black')) # Draw the unicorn's tail tail = dwg.add(dwg.g()) tail.add(dwg.polyline(points=[(340, 450), (380, 500), (420, 550)], fill='none', stroke='black', stroke_width=3)) dwg.save() draw_unicorn()This code creates an SVG image file named "unicorn.svg" that contains a simple representation of a unicorn. You can modify the code and add more details to the unicorn as desired.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.