Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,44 +1,55 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
import qdarktheme
|
| 4 |
+
from PyQt5.QtWidgets import QApplication
|
| 5 |
+
|
| 6 |
+
from app_controllers.controller import Controller
|
| 7 |
+
from app_models.model import Model
|
| 8 |
+
from app_views.view import View
|
| 9 |
+
|
| 10 |
+
model_name = "small640.pt"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class App:
|
| 14 |
+
def __init__(self):
|
| 15 |
+
super().__init__()
|
| 16 |
+
self.model = Model(model_name)
|
| 17 |
+
self.view = View(self.model)
|
| 18 |
+
self.controller = Controller(self.model, self.view)
|
| 19 |
+
print("All modules loaded")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
if __name__ == '__main__':
|
| 23 |
+
if len(sys.argv) > 2:
|
| 24 |
+
print("Error: Exactly one argument is expected")
|
| 25 |
+
sys.exit(1)
|
| 26 |
+
elif len(sys.argv) == 1:
|
| 27 |
+
print("Info: Loading default inference model: {}".format(model_name))
|
| 28 |
+
else:
|
| 29 |
+
model_name = sys.argv[1]
|
| 30 |
+
qdarktheme.enable_hi_dpi()
|
| 31 |
+
app = QApplication([])
|
| 32 |
+
qdarktheme.setup_theme('dark')
|
| 33 |
+
# update global stylesheet
|
| 34 |
+
current_stylesheet = app.styleSheet()
|
| 35 |
+
updated_stylesheet = current_stylesheet + """
|
| 36 |
+
QSlider {background-color: #323844;}
|
| 37 |
+
QGroupBox {background-color: #323844;}
|
| 38 |
+
QLabel {font-weight: bold;}
|
| 39 |
+
QPushButton{font-weight: bold;}
|
| 40 |
+
QCheckBox {font-weight: bold;}
|
| 41 |
+
QRadioButton {font-weight: bold;}
|
| 42 |
+
QComboBox {font-weight: bold;}
|
| 43 |
+
QToolTip {
|
| 44 |
+
background-color: #323844;
|
| 45 |
+
color: white;
|
| 46 |
+
font-size: 12px;
|
| 47 |
+
border: 1px solid #aaa;
|
| 48 |
+
border-radius: 4px;
|
| 49 |
+
padding: 5px;
|
| 50 |
+
}
|
| 51 |
+
"""
|
| 52 |
+
app.setStyleSheet(updated_stylesheet)
|
| 53 |
+
window = App()
|
| 54 |
+
window.view.show()
|
| 55 |
+
sys.exit(app.exec())
|