ShellyMimo/Chatbot
0
1import os2from pathlib import Path3import logging4 5logging.basicConfig(level=logging.INFO, format='[%(asctime)s]: %(message)s:')6 7 8list_of_files = [9 "src/__init__.py",10 "src/helper.py",11 "src/prompt.py",12 ".env",13 "setup.py",14 "research/trials.ipynb",15 "app.py",16 "store_index.py",17 "static/.gitkeep",18 "templates/chat.html"19 20]21 22 23for filepath in list_of_files:24 filepath = Path(filepath)25 filedir, filename = os.path.split(filepath)26 27 if filedir !="":28 os.makedirs(filedir, exist_ok=True)29 logging.info(f"Creating directory; {filedir} for the file {filename}")30 31 if (not os.path.exists(filepath)) or (os.path.getsize(filepath) == 0):32 with open(filepath, 'w') as f:33 pass34 logging.info(f"Creating empty file: {filepath}")35 36 else:37 logging.info(f"{filename} is already created")38 39 40 