changxin commited on
Commit
d8131a4
·
1 Parent(s): 445ff53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
2
  import hashlib
3
  import tempfile
4
  import requests
 
 
5
  import pandas as pd
6
  from TTS.utils.manage import ModelManager
7
  from TTS.utils.synthesizer import Synthesizer
@@ -44,12 +46,16 @@ 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':'text','text':{'title': '吹牛逼',"content": s}, 'at': {'atMobiles': [], 'isAtAll': True}}
51
  response=requests.post(url,json=data,headers=headers)
52
  return response.text
 
 
 
53
 
54
  demo=gr.Blocks()
55
  with demo:
 
2
  import hashlib
3
  import tempfile
4
  import requests
5
+ from schedule import every,repeat,run_pending
6
+ import time
7
  import pandas as pd
8
  from TTS.utils.manage import ModelManager
9
  from TTS.utils.synthesizer import Synthesizer
 
46
  a=exec(s)
47
  return {k: v for k, v in locals().items() if isinstance(v,pd.DataFrame)}
48
 
49
+ @(every(2).minutes)
50
  def fx_dd(s:str):
51
  headers= {"Content-Type": "application/json"}
52
  url="https://oapi.dingtalk.com/robot/send?access_token=4cbf5cd82f7d214566af77f893ecc9f119b78f5465d3a8fcbe4734bf73c1a7d8"
53
  data={'msgtype':'text','text':{'title': '吹牛逼',"content": s}, 'at': {'atMobiles': [], 'isAtAll': True}}
54
  response=requests.post(url,json=data,headers=headers)
55
  return response.text
56
+ while True:
57
+ run_pending()
58
+ time.sleep(1)
59
 
60
  demo=gr.Blocks()
61
  with demo: