Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

template.py 2.6 KB

You have to be logged in to leave a comment. Sign In
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  1. import logging
  2. from pathlib import Path
  3. logging.basicConfig(
  4. level=logging.INFO,
  5. format='[%(levelname)s %(asctime)s %(filename)s]: %(message)s:')
  6. project_name = "potholeClassifier"
  7. def create_directories(filepath: Path) -> None:
  8. """
  9. Create directories if they don't exist.
  10. Args:
  11. filepath (Path): Path to the file or directory.
  12. """
  13. filedir = filepath.parent
  14. if filedir != Path(""):
  15. filedir.mkdir(parents=True, exist_ok=True)
  16. logging.info(f"Creating directory: {filedir}")
  17. def create_empty_file(filepath: Path) -> None:
  18. """
  19. Create an empty file if it doesn't exist or has zero size.
  20. Args:
  21. filepath (Path): Path to the file.
  22. """
  23. if not filepath.exists() or filepath.stat().st_size == 0:
  24. with open(filepath, 'w') as f:
  25. pass
  26. logging.info(f"Creating empty file: {filepath}")
  27. def process_filepath(filepath: Path) -> None:
  28. """
  29. Process a file path by creating directories and empty files.
  30. Args:
  31. filepath (Path): Path to the file.
  32. """
  33. create_directories(filepath)
  34. create_empty_file(filepath)
  35. list_of_files = [
  36. ".github/workflows/.gitkeep",
  37. f"src/{project_name}/__init__.py",
  38. f"src/{project_name}/components/__init__.py",
  39. f"src/{project_name}/components/data_ingestion.py",
  40. f"src/{project_name}/components/prepare_base_model.py",
  41. f"src/{project_name}/components/model_training.py",
  42. f"src/{project_name}/components/model_evaluation.py",
  43. f"src/{project_name}/utils/_init__.py",
  44. f"src/{project_name}/utils/common.py",
  45. f"src/{project_name}/config/__init__.py",
  46. f"src/{project_name}/config/configuration.py",
  47. f"src/{project_name}/pipeline/__init__.py",
  48. f"src/{project_name}/pipeline/stage_01_data_ingestion.py",
  49. f"src/{project_name}/pipeline/stage_02_prepare_base_model.py",
  50. f"src/{project_name}/pipeline/stage_03_model_training.py",
  51. f"src/{project_name}/pipeline/stage_04_model_evaluation.py",
  52. f"src/{project_name}/pipeline/stage_05_prediction.py",
  53. f"src/{project_name}/entity/__init__.py",
  54. f"src/{project_name}/entity/config_entity.py",
  55. f"src/{project_name}/constants/__init__.py",
  56. "config/config.yaml",
  57. "params.yaml",
  58. "requirements.txt",
  59. "setup.py",
  60. "main.py",
  61. "dvc.yaml",
  62. "Dockerfile",
  63. "logs/logfile.log",
  64. "research/01_data_ingestion.ipynb",
  65. "research/02_prepare_base_model.ipynb",
  66. "research/03_model_training.ipynb",
  67. "research/04_model_evaluation.ipynb",
  68. "templates/index.html",
  69. 'lint.py',
  70. '.env'
  71. ]
  72. for filepath in list_of_files:
  73. process_filepath(Path(filepath))
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...