tomtat / gen_clear_view.py
tiendung's picture
first commit
675b3d2
raw
history blame
683 Bytes
import os, sys, json
from pprint import pprint
import llm
try: filename = sys.argv[1]
except: filename = ".cache/https:/vietnamnet.vn/muc-nuoc-song-cau-o-thai-nguyen-giam-dan-nguoi-dan-tat-bat-don-dep-sau-lu-2321461.html"
clean_view_filename = filename + "__clean_view.txt"
# if not os.path.exists(clean_view_filename):
text_filename = filename + ".txt"
text = open(text_filename, "rt").read()
print(f"Chuẩn bị tạo nội dung cleanview {clean_view_filename}", flush = True)
clean_view = llm.gen_clean_view(text)
with open(clean_view_filename, "wt") as f:
f.write(clean_view)
print("\n- - - CLEAN VIEW - - -\n")
print(clean_view, flush = True)