-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
70 lines (54 loc) · 2.21 KB
/
app.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import rumps
import logging
import subprocess as sp
from core import LOCALHOST_SOLUTION, AZURE_SPEECH_AUDIO_SAVE_TO_LOCAL
if LOCALHOST_SOLUTION == "False":
logging.info("IF YOU HAVE GPU ON LAPTOP, YOU CAN SETTING LOCALSOLUTION WAS True.")
# you can use bark & whisper
if AZURE_SPEECH_AUDIO_SAVE_TO_LOCAL == "True":
logging.info("WE WILL SAVE THE AUDIO FILE TO LOCAL PATH")
class OAI(rumps.App):
def __init__(self):
super(OAI, self).__init__("AIBOT", icon="icon.png")
# @rumps.clicked("聊天","随便聊聊", callback=False)
# def aichat(self, _):
# sp.Popen('python chat.py aichat', shell=True)
@rumps.clicked("聊天","模拟面试")
def interview(self, _):
# sp.call is blocking but Popen is Non-Blocking
sp.Popen('python chat.py interview', shell=True)
@rumps.clicked("聊天","口语聊天")
def speaker(self, _):
sp.Popen('python chat.py speaker', shell=True)
@rumps.clicked("识图")
def analysis(self, _):
pipe = sp.Popen('python sc.py',shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
# output,error=pipe.communicate()
if pipe.returncode == 0:
sp.Popen('python ocr.py &&',shell=True)
# @rumps.clicked("聊天","虚拟恋人")
# def lover(self, _):
# sp.Popen('python chat.py lover', shell=True)
# @rumps.clicked("聊天","心理咨询")
# def psychological(self, _):
# sp.Popen('python chat.py psychological', shell=True)
# @rumps.clicked("聊天","法律顾问")
# def lawyer(self, _):
# sp.Popen('python chat.py lawyer', shell=True)
# @rumps.clicked("识图", "分析总结")
# def analysis(self, _):
# sp.Popen(['python','sc.py'])
# @rumps.clicked("识图", "文本摘要")
# def summary(self, _):
# sp.Popen(['python','sc.py'])
# @rumps.clicked("识图", "数据分类")
# def dataclassification(self, _):
# sp.Popen(['python','sc.py'])
# @rumps.clicked("识图", "代码审计")
# def codereview(self, _):
# sp.Popen(['python','sc.py'])
# @rumps.clicked("识图", "中文翻译")
# def translator(self, _):
# sp.Popen(['python','sc.py'])
if __name__ == "__main__":
OAI().run()