-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch.py
41 lines (33 loc) · 1.14 KB
/
launch.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
import tempfile
from processors import VideoProcessor, Retriever, Config
from processors.processor import ConversationBot
from processors.llms import GPT4o
if __name__ == "__main__":
config = Config(output_folder="temp_data", video_fps=1, max_new_tokens=1500)
output_folder = tempfile.TemporaryDirectory(dir=config.output_folder)
video_processor = VideoProcessor(config=config)
retriever = Retriever(config=config)
llm = GPT4o(config=config)
bot = ConversationBot(
video_processor=video_processor,
retriever_processor=retriever,
config=config,
database_path=output_folder.name,
llm=llm
)
url = None
while not url:
url = input("Please input video url:")
if url == "exit":
import sys
sys.exit()
print(f"Reading video from url: {url} ...")
bot.read_video(url=url)
print("Indexing data ...")
bot.index(data_path=output_folder.name)
while True:
user_msg = input("User: ")
if not user_msg:
continue
response = bot.chat(user_message=user_msg)
print(f"\033[92mBot: {response}\n\033[00m")