forked from derrian-distro/LoRA_Easy_Training_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
40 lines (33 loc) · 1.05 KB
/
main.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
import os.path
import sys
import json
from PySide6 import QtWidgets
from qt_material import apply_stylesheet
from main_ui_files.MainWindow import MainWindow
def CreateConfig():
config = {"theme": {
"location": os.path.join("css", "themes", "dark_teal.xml"),
"is_light": False
}}
fp = open("config.json", 'w')
json.dump(config, fp=fp, indent=4)
fp.close()
return config
def main() -> None:
if os.path.exists("config.json"):
try:
with open("config.json", 'r') as f:
config = json.load(f)
except json.decoder.JSONDecodeError as Error:
print("Could not load config. Recreating...")
config = CreateConfig()
else:
config = CreateConfig()
app = QtWidgets.QApplication(sys.argv)
apply_stylesheet(app, theme=config['theme']['location'], invert_secondary=config['theme']['is_light'])
window = MainWindow(app)
window.setWindowTitle('LoRA Trainer')
window.show()
app.exec()
if __name__ == "__main__":
main()