Update app.py
Browse files
app.py
CHANGED
@@ -41,9 +41,11 @@ def fx_dax(s:str):
|
|
41 |
s2='<div class="result">'+s1.split('<a href')[0]+'<a href="https://pbihub.cn/users/44" target="_top"><img src="https://pbihub.cn/uploads/avatars/44_1536391253.jpg?imageView2/1/w/380/h/380" alt="万剑归宗" class="badge" width="380" height="380"></a>'
|
42 |
return s2
|
43 |
|
44 |
-
def fx_datatable(
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
|
48 |
def fx_dd(tk:str,s:str):
|
49 |
headers= {"Content-Type": "application/json"}
|
@@ -98,8 +100,8 @@ with demo:
|
|
98 |
|
99 |
with gr.TabItem("Python-Execute"):
|
100 |
gr.Markdown("# Python脚本测试")
|
101 |
-
d_input=gr.Textbox(label="请填写需要datatable库处理的脚本",lines=18)
|
102 |
-
d_output=gr.
|
103 |
d_button=gr.Button("开始编译>>")
|
104 |
d_button.click(fx_datatable, inputs=d_input, outputs=d_output,api_name='pyexe')
|
105 |
|
|
|
41 |
s2='<div class="result">'+s1.split('<a href')[0]+'<a href="https://pbihub.cn/users/44" target="_top"><img src="https://pbihub.cn/uploads/avatars/44_1536391253.jpg?imageView2/1/w/380/h/380" alt="万剑归宗" class="badge" width="380" height="380"></a>'
|
42 |
return s2
|
43 |
|
44 |
+
def fx_datatable(code:str):
|
45 |
+
namespace = {}
|
46 |
+
fun = compile(code,'<string>','exec')
|
47 |
+
exec(fun,namespace)
|
48 |
+
return namespace['py_exe']
|
49 |
|
50 |
def fx_dd(tk:str,s:str):
|
51 |
headers= {"Content-Type": "application/json"}
|
|
|
100 |
|
101 |
with gr.TabItem("Python-Execute"):
|
102 |
gr.Markdown("# Python脚本测试")
|
103 |
+
d_input=gr.Textbox(label="请填写需要datatable库处理的脚本(最终输出使用变量名py_exe)",lines=18)
|
104 |
+
d_output=gr.DataFrame(label="输出>")
|
105 |
d_button=gr.Button("开始编译>>")
|
106 |
d_button.click(fx_datatable, inputs=d_input, outputs=d_output,api_name='pyexe')
|
107 |
|