FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-interpreter/python/example.py at main · e2b-dev/code-interpreter · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
e2b-dev
/
code-interpreter
Public
Notifications
You must be signed in to change notification settings
Fork
224
Star
2.4k
Code
Issues
15
Pull requests
5
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
code-interpreter
/
python
/
example.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (27 loc) · 858 Bytes
Breadcrumbs
code-interpreter
/
python
/
example.py
Copy path
File metadata and controls
42 lines (27 loc) · 858 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import
asyncio
from
dotenv
import
load_dotenv
from
e2b_code_interpreter
import
Sandbox
load_dotenv
()
code
=
"""
import matplotlib.pyplot as plt
import numpy as np
# Step 1: Define the data for the pie chart
categories = ["No", "No, in blue"]
sizes = [90, 10]
# Step 2: Create the figure and axis objects
fig, ax = plt.subplots(figsize=(8, 8))
plt.xlabel("x")
plt.ylabel("y")
# Step 3: Create the pie chart
ax.pie(sizes, labels=categories, autopct='%1.1f%%', startangle=90, colors=plt.cm.Pastel1.colors[:len(categories)])
# Step 4: Add title and legend
ax.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle
plt.title('Will I wake up early tomorrow?')
# Step 5: Show the plot
plt.show()
"""
async
def
run
():
sbx
=
Sandbox
.
create
(
timeout
=
60
)
e
=
sbx
.
run_code
(
code
)
print
(
e
.
results
[
0
].
chart
)
asyncio
.
run
(
run
())
Back
|
FazBrowse Home
|
New Git URL