Spaces:
Runtime error
Runtime error
Shroominic
commited on
Commit
·
8f62e66
1
Parent(s):
b8c82e5
fix test
Browse files- examples/plot_sin_wave.py +14 -1
examples/plot_sin_wave.py
CHANGED
|
@@ -7,7 +7,20 @@ async def main():
|
|
| 7 |
output = await session.generate_response(user_request)
|
| 8 |
|
| 9 |
print(output.content)
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
if __name__ == "__main__":
|
|
|
|
| 7 |
output = await session.generate_response(user_request)
|
| 8 |
|
| 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 |
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|