-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
724 lines (598 loc) · 24.1 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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
import kivy
from kivymd.app import MDApp as App
from kivymd.uix.label import MDLabel as Label
from kivymd.uix.gridlayout import MDGridLayout as GridLayout
from kivymd.uix.floatlayout import MDFloatLayout as FloatLayout
from kivymd.uix.button import MDRectangleFlatButton, MDRaisedButton
from kivymd.uix.textfield import MDTextField as TextInput
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.scatter import Scatter
from kivymd.uix.boxlayout import MDBoxLayout as BoxLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.graphics import *
from kivy.core.window import Window
from kivy.properties import *
from kivy.graphics.texture import Texture
from kivy.utils import platform
from kivy_garden.xcamera import XCamera
from kivymd.uix.progressbar import MDProgressBar
from kivy.clock import Clock
from kivymd.uix.button import MDIconButton
from kivymd.uix.filemanager import MDFileManager
from kivy.clock import mainthread
import time
import numpy as np
import image_to_numpy
from os.path import isfile, isdir
import cv2
import string
from solvers import Solvers
from imageReader import ImageProcessing
from annotator import Annotator
import threading
# kivy.require("2.0")
if platform == "android":
print("requested permissions")
from android.permissions import request_permissions, Permission
from android.storage import primary_external_storage_path
request_permissions(
[
Permission.WRITE_EXTERNAL_STORAGE,
Permission.READ_EXTERNAL_STORAGE,
Permission.CAMERA,
]
)
### step 1 ###
class StartPage(FloatLayout):
def __init__(self, caller, **kwargs):
self.caller = caller
super().__init__(**kwargs)
self.title = Label(text="Find-a-word Solver")
self.title.size_hint = (1, 0.1)
self.title.pos_hint = {"center_x": 0.5, "y": 0.9}
self.title.halign = "center"
self.add_widget(self.title)
self.buttons = FloatLayout(adaptive_size=True)
self.buttons.cols = 2
self.loadButton = MDRaisedButton(text="Load File")
self.loadButton.size_hint = (0.9, 0.4)
self.loadButton.pos_hint = {"x": 0.05, "y": 0.05}
self.loadButton.bind(on_release=self.loadImage)
self.add_widget(self.loadButton)
self.cameraButton = MDRaisedButton(text="Camera (WIP)")
self.cameraButton.size_hint = (0.9, 0.4)
self.cameraButton.pos_hint = {"x": 0.05, "y": 0.5}
self.cameraButton.bind(on_release=self.launchCamera)
self.add_widget(self.cameraButton)
# self.add_widget(self.buttons)
def loadImage(self, instance):
self.title.text = "test"
self.caller.goToPage("Load")
def launchCamera(self, instance):
self.caller.goToPage("Camera")
### step 2, load###
class LoadPage(FloatLayout):
def __init__(self, caller, **kwargs):
self.caller = caller
print("caller goToPage", type(self.caller.goToPage))
super().__init__()
self.file_thing = MDFileManager()
self.file_thing.select_path = self.select_path
self.file_thing.preview = True
self.file_thing.sort_by = "date"
if platform == "android":
from os.path import join
print(
"primary_external_storage_path : ",
join(primary_external_storage_path(), "DCIM", "Camera"),
)
self.path = join(primary_external_storage_path(), "DCIM", "Camera")
else:
self.path = "./wss-test-images/fulls"
# self.add_widget(self.file_thing)
def select_path(self, path, *args):
if isfile(path):
print("thing selected", path)
self.file_thing.close()
self.caller.pages["LineUp"].setImage(path, camera=False)
self.caller.goToPage("LineUp")
else:
print("non file selected", path)
def stopped(self):
print("called close on the file thing")
self.file_thing.close()
def started(self):
self.file_thing.show(self.path)
### step 2, camera ###
class CameraPage(FloatLayout):
def __init__(self, caller, **kwargs):
self.caller = caller
super().__init__(**kwargs)
self.camera = XCamera(play=True)
self.camera.on_picture_taken = self.picture_taken
self.add_widget(self.camera)
if platform == "android":
from os.path import join
from os import mkdir
path = join(primary_external_storage_path(), "Pictures", "WordSearchSolver")
if not isdir(path):
try:
mkdir(path)
except OSError:
print("Creation of the directory %s failed" % path)
else:
print("Successfully created the directory %s " % path)
self.camera.directory = path
# self.title = Label(text="Try to get the grid flat and square-on")
# self.title.size_hint = (1, 0.1)
# self.add_widget(self.title)
def picture_taken(self, filename):
self.leave(filename)
def leave(self, filename):
self.caller.pages["LineUp"].setImage(filename, camera=True)
print("Picture taken and saved to {}".format(filename))
self.caller.goToPage("LineUp")
def started(self):
self.camera.force_landscape()
self.camera.play = True
def stopped(self):
self.camera.restore_orientation()
self.camera.play = False
self.camera._camera._release_camera()
### 3 ###
class LineUpPage(FloatLayout):
"""
Displays an image and a movable square that allows the user to select the reigon of interest
"""
def __init__(self, caller, **kwargs):
self.caller = caller
super().__init__(**kwargs)
self.imgFilename = "None"
self.angle = 0
self.movingLayout = Scatter()
self.movingLayout.do_rotation = False
self.add_widget(self.movingLayout)
self.continueButton = MDRaisedButton(
text="Continue", size_hint=(0.15, 0.1), pos_hint={"x": 0.85, "y": 0.9}
)
self.add_widget(self.continueButton)
self.on_touch_up = self.buttonTouchCheck
self.refreshButton = MDRaisedButton(
text="Rotate", size_hint=(0.125, 0.075), pos_hint={"x": 0, "y": 0}
)
self.add_widget(self.refreshButton)
self.squareMargin = 0.1
Window.bind(on_resize=lambda *args: self.makeSquare(self.squareMargin))
def buttonTouchCheck(self, touch, *args):
# called in place of the usual collitions to make sure the buttons have top priority
if self.continueButton.collide_point(*touch.pos):
self.continued()
elif self.refreshButton.collide_point(*touch.pos):
self.rotate()
else:
return self.movingLayout.on_touch_up(touch)
def rotate(self, *args):
# changes the rotatorion value and reloads the image completely
# TO_DO: could just rotate the image without wasting time reloading it
self.angle += 1
if self.angle >= 4:
self.angle = 0
self.setImage(self.imgFilename)
self.started(rotating=True)
def setImage(self, img, camera=False):
# loads and renders the given image and the line-up square on top of it
print("path given: ", img)
self.imgFilename = img
def started(self, rotating=False):
if(rotating):
self._started()
else:
Clock.schedule_once(self._started, 1)
def _started(self, *args):
err = self.getImageTexture(self.imgFilename)
# if(not err):
self.makeSquare(self.squareMargin)
def continued(self, *args):
# called when the continued button is pressed to go to the next page
self.caller.pages["Words"].setStuff(self.imgFilename, self.getPosCv())
self.caller.goToPage("Words")
def getPosCv(self):
# gets the coordinates of each corner of the line-up square with the origin top left
size = min(
self.imgSize[0] * Window.size[0], self.imgSize[1] * Window.size[1]
) * (0.5 - self.squareMargin / 2)
midX, midY = Window.size[0] / 2, Window.size[1] / 2
topLeft = self.squareToImg(midX - size, midY + size)
topRight = self.squareToImg(midX + size, midY + size)
bottomLeft = self.squareToImg(midX - size, midY - size)
bottomRight = self.squareToImg(midX + size, midY - size)
return topLeft, topRight, bottomRight, bottomLeft
def squareToImg(self, x, y):
# converts a pos from the movable square to image based position
# the position in the window in pixels
kivyPosPx = self.movingLayout.to_parent(
x, y
)
# the position in the window as a percent
kivyPosPe = [
kivyPosPx[0]/Window.size[0],
1-(kivyPosPx[1]/Window.size[1])
]
imPos = [
(kivyPosPe[0] - self.imgPos[0]) / self.imgSize[0],
(kivyPosPe[1] - self.imgPos[1]) / self.imgSize[1],
]
return imPos
def getImageTexture(self, source):
"""
loads an image and turns it into a kivy texture
also rotated it based on self.angle which is an int from 0-3
returns: error bool
"""
err = False
if not isfile(source):
print("wasnt a file yet")
Clock.schedule_once(lambda *_:self.getImageTexture(source), 1)
source = "temp_img.png"
err = True
print("source for getImgTexture was", source)
# loads image into numpy array
self.imgNp = image_to_numpy.load_image_file(source).astype(np.uint8)
self.imgNp = np.flip(self.imgNp, 0)
# rotates it based on self.angle
print("angle", self.angle, " angle given", self.angle - 1)
if self.angle != 0:
self.imgNp = cv2.rotate(self.imgNp, self.angle - 1)
# turn numpy array into buffer
self.imgBuf = self.imgNp.tobytes()
print("imgBug type", type(self.imgBuf), "imgNp dtype", self.imgNp.dtype)
# then into kivy texture
self.imgTex = Texture.create(
size=(self.imgNp.shape[1], self.imgNp.shape[0])
)
self.setImageTexture()
self.imgTex.add_reload_observer(self.setImageTexture)
# self.canvas.ask_update()
return err
def setImageTexture(self, *_):
self.imgTex.blit_buffer(
self.imgNp.flatten(), bufferfmt="ubyte", colorfmt="rgb"
) # default colorfmt and bufferfmt
def makeSquare(self, margin):
"""
draws the line-up square and image to the movingLayout canvas
"""
if self.caller.currentPage() == self:
# ===== Calculates positions for the image and square ====
# find if the width/height ratio of the image is more or less than the window
imgRatio = self.imgNp.shape[1] / self.imgNp.shape[0]
if (Window.size[0] / Window.size[1]) > (
self.imgNp.shape[1] / self.imgNp.shape[0]
):
height = Window.size[1]
width = (
height * imgRatio
) # set the height to fill the window and width to scale according to the image ratio
self.imgSize = [width / Window.size[0], height / Window.size[1]]
else:
width = Window.size[0]
height = width * (
self.imgNp.shape[0] / self.imgNp.shape[1]
) # set the width to fill the window and height to scale according to the ratio (backwards)
self.imgSize = [width / Window.size[0], height / Window.size[1]]
x = (Window.size[0] / 2) - (
self.imgSize[0] * Window.size[0]
) / 2 # sets position so that the image is centerd as:
y = (Window.size[1] / 2) - (
self.imgSize[1] * Window.size[1]
) / 2 # the middle of the window minus half the image size
self.imgPos = [x / Window.size[0], y / Window.size[1]]
# ===== Draws a rectangle with the image onto self's canvas =====
self.canvas.clear()
with self.canvas:
print("image size/position: ", x, y, self.imgSize[0] * Window.size[0],
self.imgSize[1] * Window.size[1])
print("imgTex ", self.imgTex)
Color(1, 1, 1, mode='rgb') # have to have this
Rectangle(
pos=(x, y),
size=(
self.imgSize[0] * Window.size[0],
self.imgSize[1] * Window.size[1],
),
texture=self.imgTex,
)
self.remove_widget(self.movingLayout)
self.movingLayout.canvas.clear()
with self.movingLayout.canvas:
Color(0, 1.0, 0)
size = min(
self.imgSize[0] * Window.size[0], self.imgSize[1] * Window.size[1]
) * (
0.5 - margin / 2
) # half of the side length of the line-up square
midX, midY = Window.size[0] / 2, Window.size[1] / 2
Line(rectangle=(midX - size, midY - size, size * 2, size * 2), width=3)
self.add_widget(self.movingLayout)
# have to remove and re add the widgets so that their collisions get processed first
self.remove_widget(self.continueButton)
self.add_widget(self.continueButton)
self.remove_widget(self.refreshButton)
self.add_widget(self.refreshButton)
### 4 ###
class WordsPage(FloatLayout):
def __init__(self, caller, **kwargs):
self.caller = caller
super().__init__(**kwargs)
self.textinput = TextInput(
hint_text="Enter words",
multiline=False,
size_hint=(0.65, 0.1),
pos_hint={"x": 0.05, "y": 0.85},
text_validate_unfocus=False,
)
self.textinput.bind(on_text_validate=self.addWord) # pressed enter
self.add_widget(self.textinput)
self.addButton = MDRaisedButton(
text="Add", size_hint=(0.2, 0.1), pos_hint={"x": 0.75, "y": 0.85}
)
self.addButton.bind(on_release=self.addWord) # pressed add button
self.add_widget(self.addButton)
self.words = []
self.wordsWidgets = []
self.wordsLayout = GridLayout(
size_hint=(0.9, 0.7), pos_hint={"x": 0.05, "y": 0.1}
)
self.wordsLayout.cols = 2
self.add_widget(self.wordsLayout)
self.continueButton = MDRaisedButton(
text="Continue", pos_hint={"x": 0.79, "y": 0.01}, size_hint=(0.2, 0.1)
)
self.add_widget(self.continueButton)
self.continueButton.bind(on_release=self.continueToSolve)
self.img = "not set yet"
self.cropPos = "not set yet"
def testWord(self, word):
# tests if should add a word
if word in self.words or len(word) < 1:
return False
else:
return True
def addWord(self, *args):
# creates a new WordWidget and adds word to self.words
# is a callback for self.addButton.on_release
word = "".join([l for l in self.textinput.text.lower() if l in string.ascii_letters])
if self.testWord(word):
self.words.append(word)
self.textinput.text = ""
self.wordsWidgets.append(
WordWidget(text=self.words[-1], caller=self, appCaller=self.caller)
)
self.wordsLayout.add_widget(self.wordsWidgets[-1])
def removeWord(self, wordName):
wordIndex = self.words.index(wordName)
self.wordsLayout.remove_widget(self.wordsWidgets[wordIndex])
del self.words[wordIndex]
del self.wordsWidgets[wordIndex]
def continueToSolve(self, *args):
Clock.schedule_once(
lambda *_: self.caller.pages["Solver"].solve(
self.img, self.words, self.cropPos
)
)
self.caller.goToPage("Solver")
def getSet(self):
return self.img == "not set yet" and self.cropPos == "not set yet"
def setStuff(self, img, pos): # this is the path not the actual image
self.img = img
self.cropPos = pos
class WordWidget(RelativeLayout):
def __init__(self, text, caller, appCaller, **kwargs):
# self.radius = [25, ]
# self.md_bg_color = appCaller.theme_cls.primary_color
# icons: "delete" "delete-circle" "delete-forever" close" "close-circle" "close-cricle-outline"
self.caller = caller
super().__init__(**kwargs)
self.textLabel = Label(text=text)
self.add_widget(self.textLabel)
self.removeButton = MDIconButton(icon="delete")
self.removeButton.user_font_size = "32sp"
self.removeButton.theme_text_color = "Custom"
self.removeButton.text_color = appCaller.theme_cls.primary_color
self.removeButton.pos_hint = {"center_x": 0.7, "center_y": 0.5}
self.removeButton.bind(on_release=self.remove)
self.add_widget(self.removeButton)
def remove(self, *args):
self.caller.removeWord(self.textLabel.text)
checkpoint_times = [ # times to base the loading bar off
0.022075414657592773,
0.7521471977233887,
0.8141767978668213,
0.8585145473480225,
0.863696813583374,
1.302180528640747,
1.312652349472046,
3.0844106674194336,
3.089580535888672,
3.3388493061065674,
3.3389062881469727,
]
### 5 ###
class SolvePage(FloatLayout):
def __init__(self, caller, **kwargs):
self.caller = caller
super().__init__(**kwargs)
self.loader = MDProgressBar()
self.loader.pos_hint = {"center_x": 0.5, "center_y": 0.55}
self.add_widget(self.loader)
self.message = Label(text="Loading")
self.message.pos_hint = {"center_x": 0.5, "center_y": 0.4}
self.add_widget(self.message)
self.start_time = 0
self.checkpoint = 0
@mainthread
def setLoadInfo(self, value, message):
# print("time since start", time.time()-self.start_time)
self.loader.value = (
checkpoint_times[self.checkpoint] / checkpoint_times[-1]
) * 100
self.message.text = message
self.checkpoint += 1
def solve(self, imgPath, lookWords, pos):
# call _solve in another thread
self.start_time = time.time()
self.outImg = "not set"
self.thread = threading.Thread(
target=SolvePage._solve, args=(imgPath, lookWords, pos, self)
)
print("solve looking for", lookWords, "in", imgPath, "at", pos)
self.checkDoneEvent = Clock.schedule_interval(
self.checkDone, 1
) # checks if _solve is done and goes to next page
self.thread.start()
# SolvePage._solve(imgPath, lookWords, pos, self)
def _solve(imgPath, words, pos, pageInst):
pageInst.setLoadInfo(0, "Loading Image")
pageInst.imgPath = imgPath
pageInst.img = ImageProcessing.loadImg(pageInst.imgPath)
if pageInst.caller.pages["LineUp"].angle != 0:
print("rotated", 3-pageInst.caller.pages["LineUp"].angle)
pageInst.img = cv2.rotate(
pageInst.img, 3-pageInst.caller.pages["LineUp"].angle
)
grid, gridPlus, allGrids = ImageProcessing.processImage(
pageInst.img, pos, debug=False, progressCallback=pageInst.setLoadInfo
)
pageInst.setLoadInfo(10, "Finding Words")
foundWords = Solvers.wordSearch(allGrids, words, True)
pageInst.setLoadInfo(10, "Annotating Image")
outImg = Annotator.annotate(pageInst.img, gridPlus, pos, foundWords)
pageInst.setLoadInfo(10, "Done")
pageInst.outImg = outImg
@mainthread
def done(self, outImg):
self.checkDoneEvent.cancel()
print("called done")
self.thread.join()
self.caller.pages["Final"].setImageBuf(self.outImg)
self.caller.goToPage("Final")
@mainthread
def checkDone(self, *args):
if type(self.outImg) == str:
return False
else:
print("outImg has been set")
self.done(self.outImg)
def stopped(self):
pass
# print("got to stopped")
# self.thread.join()
# self.done(self.outImg)
# print("got past .join")
### 6 ###
class FinalPage(FloatLayout):
def __init__(self, caller, **kwargs):
self.caller = caller
super().__init__(**kwargs)
self.againButton = MDRaisedButton(
text="Again",
pos=(Window.size[0] * 0.01, Window.size[1] * 0.01),
size_hint=(0.1, 0.1),
)
with self.canvas:
self.rect = Rectangle(pos=(0, 0), size=(Window.size[0], Window.size[1]))
self.add_widget(self.againButton)
self.againButton.bind(on_release=self.goAgain)
self.imgPath = "not set"
def goAgain(self, *args):
self.caller.goToPage("Start")
def setImageBuf(self, img):
print("final page image set ", type(img), img.shape)
# takes a numpy image
# turn numpy array into buffer
self.imgBuf = img.tobytes()
# then into kivy texture
self.imgTex = Texture.create(size=(img.shape[1], img.shape[0]), colorfmt="rgb")
self.imgTex.blit_buffer(
self.imgBuf, bufferfmt="ubyte", colorfmt="rgb"
) # default colorfmt and bufferfmt
self.canvas.clear()
self.remove_widget(self.againButton)
with self.canvas:
Color(1, 1, 1, mode="rgb") # have to have this
self.rect = Rectangle(
pos=(0, 0),
size=(Window.size[0], Window.size[1]),
colorfmt="rgb",
texture=self.imgTex,
)
self.add_widget(self.againButton)
class SolverApp(App):
def key_handler(self, window, key, scancode, codepoint, modifiers):
if key == 27:
self.backPage()
return True
else:
return False
def addPage(self, name, pageClass):
self.pages[name] = pageClass(self)
screen = Screen(name=name)
screen.add_widget(self.pages[name])
self.screen_manager.add_widget(screen)
def build(self):
Window.bind(on_keyboard=self.key_handler)
self.lastPages = []
self.pages = {}
self.screen_manager = ScreenManager()
self.addPage("Start", StartPage)
self.addPage("Load", LoadPage)
self.addPage("Camera", CameraPage)
self.addPage("LineUp", LineUpPage)
self.addPage("Words", WordsPage)
self.addPage("Solver", SolvePage)
self.addPage("Final", FinalPage)
return self.screen_manager
def goToPage(self, name, backing = False):
print(f"going to {name} page")
if backing == False:
self.lastPages.append(self.screen_manager.current)
try:
self.pages[self.screen_manager.current].stopped()
except AttributeError:
# print("no start function")
...
self.screen_manager.current = name
try:
self.pages[name].started()
except AttributeError:
# print("no end function")
...
def backPage(self):
print("back page called", self.lastPages)
if len(self.lastPages) >= 1:
self.goToPage(self.lastPages[-1], backing=True)
del self.lastPages[-1]
def currentPage(self):
return self.pages[self.currentPageName()]
def currentPageName(self):
return self.screen_manager.current
class TestApp(App):
def build(self):
import time
time.sleep(5)
self.layout = FloatLayout()
try:
self.camera = XCamera(play=True)
# self.camera.play = False
self.layout.add_widget(self.camera)
except AttributeError:
print("XCamera failed to start")
self.testButton = MDRaisedButton(text="test button")
self.layout.add_widget(self.testButton)
return self.layout
__version__ = "0.1"
if __name__ == "__main__":
solver_app = SolverApp()
SolverApp().run()
# test_app = TestApp()
# test_app.run()