dlimeng commited on
Commit
2c7e0ee
·
1 Parent(s): 4e34dff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -8,8 +8,14 @@ import json
8
  import re
9
 
10
 
 
 
 
 
 
 
11
 
12
- # 执行 Python 代码并生成图像
13
  def execute_code(code):
14
  namespace = {}
15
  exec(code, namespace)
 
8
  import re
9
 
10
 
11
+ def get_image_data(fig):
12
+ buf = io.BytesIO()
13
+ fig.savefig(buf, format='png')
14
+ buf.seek(0)
15
+ img = Image.open(buf)
16
+ return img
17
 
18
+ # Execute Python code and generate images
19
  def execute_code(code):
20
  namespace = {}
21
  exec(code, namespace)