We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a53ef66 commit 795fd03Copy full SHA for 795fd03
1 file changed
examples/plot_sin_wave.py
@@ -4,24 +4,11 @@
4
async def main():
5
async with CodeInterpreterSession() as session:
6
user_request = "Plot a sin wave and show it to me."
7
+
8
output = await session.generate_response(user_request)
9
- print(output.content)
10
-
11
- try:
12
- from PIL import Image # type: ignore
13
- except ImportError:
14
- print("Please install it with `pip install codeinterpreterapi[image_support]` to display images.")
15
- exit(1)
16
17
- from io import BytesIO
18
file = output.files[0]
19
- img_io = BytesIO(file.content)
20
- img = Image.open(img_io)
21
22
- # Display the image
23
- img.show()
24
+ file.show_image()
25
26
if __name__ == "__main__":
27
import asyncio
0 commit comments