核心功能 - 电池指示灯

这个方便的脚本可以让你设置你想要得到通知的电池百分比,该脚本使用 Pyler 进行通知,使用 Psutil 获取当前的电池百分比。

实现代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


# Battery Notifier


# pip instal plyer


from plyer import notification


import psutil


from time import sleep


while True:


    battery = psutil.sensors_battery()


    life = battery.percent


    if life < 50:


        notification.notify(


            title = "Battery Low",


            message = "Please connect to power source",


            timeout = 10


        )


    sleep(60)

语法固定器

厌倦了校对你的长文章或文本,然后,你可以试试这个自动化脚本,它将扫描你的文本并纠正语法错误,这个很棒的脚本使用 Happtransformer 模块,这是一个机器学习模块,经过训练可以修复文本中的语法错误。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33


# Grammer Fixer


# pip install happytransformer


from happytransformer import HappyTextToText as HappyTTT


from happytransformer import TTSettings


def Grammer_Fixer(Text):


    Grammer = HappyTTT("T5","prithivida/grammar_error_correcter_v1")


    config = TTSettings(do_sample=True, top_k=10, max_length=100)


    corrected = Grammer.generate_text(Text, args=config)


    print("Corrected Text: ", corrected.text)


Text = "This is smple tet we how know this"


Grammer_Fixer(Text)