changxin commited on
Commit
b3c7ae9
1 Parent(s): 099ca4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -41,7 +41,7 @@ def fx_dax(s:str):
41
 
42
  def fx_datatable(s:str):
43
  a=exec(s)
44
- return locals().items()
45
 
46
  demo=gr.Blocks()
47
  with demo:
@@ -76,7 +76,7 @@ with demo:
76
  with gr.TabItem("Python-Execute"):
77
  gr.Markdown("# Python脚本测试")
78
  d_input=gr.Textbox(label="请填写需要datatable库处理的脚本",lines=18)
79
- d_output=gr.Dataframe(label="输出>")
80
  d_button=gr.Button("开始编译>>")
81
  d_button.click(fx_datatable, inputs=d_input, outputs=d_output,api_name='datatable')
82
  demo.launch()
 
41
 
42
  def fx_datatable(s:str):
43
  a=exec(s)
44
+ return {k: v.to_json(force_ascii = False) for k, v in x.items() if isinstance(v,pd.DataFrame)}
45
 
46
  demo=gr.Blocks()
47
  with demo:
 
76
  with gr.TabItem("Python-Execute"):
77
  gr.Markdown("# Python脚本测试")
78
  d_input=gr.Textbox(label="请填写需要datatable库处理的脚本",lines=18)
79
+ d_output=gr.JSON(label="输出>")
80
  d_button=gr.Button("开始编译>>")
81
  d_button.click(fx_datatable, inputs=d_input, outputs=d_output,api_name='datatable')
82
  demo.launch()