Delete helperbot_bigdl.py
Browse files- helperbot_bigdl.py +0 -46
helperbot_bigdl.py
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
from models.whisper_model import AudioTranslator
|
2 |
-
from models.llm_model import LlmReasoner
|
3 |
-
|
4 |
-
|
5 |
-
class Chat:
|
6 |
-
|
7 |
-
def __init__(self, args) -> None:
|
8 |
-
self.args = args
|
9 |
-
|
10 |
-
def init_model(self):
|
11 |
-
print('\033[1;33m' + "Initializing models...".center(50, '-') + '\033[0m')
|
12 |
-
self.audio_translator = AudioTranslator(self.args)
|
13 |
-
self.llm_reasoner = LlmReasoner(self.args)
|
14 |
-
|
15 |
-
print('\033[1;32m' + "Model initialization finished!".center(50, '-') + '\033[0m')
|
16 |
-
|
17 |
-
def video2log(self, video_path):
|
18 |
-
audio_results = self.audio_translator(video_path)
|
19 |
-
|
20 |
-
en_log_result = []
|
21 |
-
en_log_result_tmp = ""
|
22 |
-
audio_transcript = self.audio_translator.match(audio_results)
|
23 |
-
en_log_result_tmp += f"\n{audio_transcript}"
|
24 |
-
|
25 |
-
en_log_result.append(en_log_result_tmp)
|
26 |
-
|
27 |
-
en_log_result = "\n\n".join(en_log_result)
|
28 |
-
print(f"\033[1;34mLog: \033[0m\n{en_log_result}\n")
|
29 |
-
|
30 |
-
return en_log_result
|
31 |
-
|
32 |
-
def chat2video(self, args, user_input, en_log_result):
|
33 |
-
self.llm_reasoner.create_qa_chain(args, en_log_result)
|
34 |
-
en_user_input = user_input
|
35 |
-
|
36 |
-
print("\n\033[1;32mGnerating response...\033[0m")
|
37 |
-
answer, generated_question, source_documents = self.llm_reasoner(en_user_input)
|
38 |
-
print(f"\033[1;32mQuestion: \033[0m{user_input}")
|
39 |
-
print(f"\033[1;32mAnswer: \033[0m{answer[0][1]}")
|
40 |
-
self.clean_history()
|
41 |
-
|
42 |
-
return answer, generated_question, source_documents
|
43 |
-
|
44 |
-
def clean_history(self):
|
45 |
-
self.llm_reasoner.clean_history()
|
46 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|