1 Star 4 Fork 2

QuanHaHQuan/AI based chatbot.(AI聊天机器人)

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
Quan-star 提交于 2022-01-10 09:23 . update main.py.
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
import time
import threading
from page import *
import QA
from recordingThread import startRecording, stopRecording
from TextToSpeech import TTS
import facerecognition
from sentence_transformers import SentenceTransformer, util
from transformers import pipeline
import face_recognition
import cv2
import numpy as np
import time
import matplotlib as plt
#初始化窗口
class MyWindow(QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
name = facerecognition.recognition()
super(MyWindow, self).__init__(parent)
self.setupUi(self)
self.output.append("hello "+name)
TTS("hello"+name)
#录音
def MakeVoice(self):
startRecording()
#停止录音
def EndVoice(self):
self.plainTextEdit.setPlainText("正在回答~")
stopRecording()
# 转文本
thBaiduYuYin = QA.BaiduYuYinThread()
thBaiduYuYin.start()
Question=thBaiduYuYin.run()
#self.input.clear()
self.input.append(Question)
thBaiduYuYin.join()
# 回答
thQA_fun = QA.QA_funThread(Question)
thQA_fun.start()
Answer=thQA_fun.run()
#self.output.clear()
self.output.append(Answer)
TTS(Answer)
thQA_fun.join()
self.plainTextEdit.setPlainText("等待问题中~")
if __name__ == '__main__':
# 创建窗口实例
app = QtWidgets.QApplication(sys.argv)
myWin = MyWindow()
myWin.show()
sys.exit(app.exec_())
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/quanquaqu/ai-based-chatbot.git
git@gitee.com:quanquaqu/ai-based-chatbot.git
quanquaqu
ai-based-chatbot
AI based chatbot.(AI聊天机器人)
master

搜索帮助