changxin commited on
Commit
98cf4b9
1 Parent(s): b44f356

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -43,6 +43,13 @@ def fx_dax(s:str):
43
  def fx_datatable(s:str):
44
  a=exec(s)
45
  return {k: v for k, v in locals().items() if isinstance(v,pd.DataFrame)}
 
 
 
 
 
 
 
46
 
47
  demo=gr.Blocks()
48
  with demo:
@@ -80,5 +87,12 @@ with demo:
80
  d_output=gr.JSON(label="输出>")
81
  d_button=gr.Button("开始编译>>")
82
  d_button.click(fx_datatable, inputs=d_input, outputs=d_output,api_name='datatable')
 
 
 
 
 
 
 
83
  demo.launch()
84
 
 
43
  def fx_datatable(s:str):
44
  a=exec(s)
45
  return {k: v for k, v in locals().items() if isinstance(v,pd.DataFrame)}
46
+
47
+ def fx_dd(s:str):
48
+ headers= {"Content-Type": "application/json"}
49
+ url="https://oapi.dingtalk.com/robot/send?access_token=4cbf5cd82f7d214566af77f893ecc9f119b78f5465d3a8fcbe4734bf73c1a7d8"
50
+ data={"msgtype": "action_card","action_card": {"title": s,"markdown": "# 万般带不走 半点不由人","single_title": "查看详情","single_url": "https://pbihub.cn/users/44"}}
51
+ respose=requests.post(url,json=data,headers=headers)
52
+ return '推送成功!'
53
 
54
  demo=gr.Blocks()
55
  with demo:
 
87
  d_output=gr.JSON(label="输出>")
88
  d_button=gr.Button("开始编译>>")
89
  d_button.click(fx_datatable, inputs=d_input, outputs=d_output,api_name='datatable')
90
+
91
+ with gr.TabItem("钉钉群消息推送"):
92
+ gr.Markdown("# 推送测试")
93
+ dd_input=gr.Textbox(label="请填写需要推送的信息",lines=18)
94
+ dd_output=gr.Textbox(label="推送提示")
95
+ dd_button=gr.Button("提交")
96
+ dd_button.click(fx_dd, inputs=dd_input, outputs=dd_output,api_name='dingding')
97
  demo.launch()
98