File size: 1,023 Bytes
10ebdb4 |
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 |
from model import TransformerModel
from data import load_data, save_data
import utils
def main():
# Load config từ file JSON
config = load_data('config.json')
# Tạo mô hình dựa trên config
model = TransformerModel(config)
# Load dữ liệu tương tác
interaction_data = load_data('interaction_data.json')
# Code để tương tác với người dùng
while True:
user_input = input("Bạn: ")
if user_input.lower() == 'quit':
break
# Xử lý đầu vào
processed_input = utils.process_string(user_input)
# Dự đoán và tạo phản hồi
response = model.predict(processed_input)
# Hiển thị phản hồi cho người dùng
print("Mô hình: ", response)
# Lưu trữ dữ liệu tương tác
interaction_data.append({"input": user_input, "response": response})
save_data(interaction_data, "interaction_data.json")
if __name__ == "__main__":
main()
|