-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
59 lines (38 loc) · 1.79 KB
/
Copy pathapp.py
File metadata and controls
59 lines (38 loc) · 1.79 KB
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
from pathlib import Path
from nicegui import ui
from web.pages.analysis_page import science_articles_page
from web.pages.image_processing_page import image_processing_page
from web.pages.settings_page import settings_page
data_ready = False
def check_data_ready(): # noqa: D103
required_files = ["specializations.json", "vak_articles.json", "whitelist_articles.json"]
return all((Path("data") / name).exists() for name in required_files)
def update_data_status(): # noqa: D103
global data_ready # noqa: PLW0603
data_ready = check_data_ready()
@ui.page("/")
def main_page(): # noqa: D103
update_data_status() # при заходе на страницу проверим наличие данных
with ui.header().classes("items-center justify-between p-4 shadow-md"):
with ui.row().classes("items-center gap-4"):
with ui.link(target="/"):
ui.image("./web/static/logo.png").classes("w-12 h-12")
ui.label("Science Helper").classes("text-xl font-bold")
with ui.tabs().classes("w-full") as tabs:
tab1 = ui.tab("Обработчик изображений")
tab2 = ui.tab("Парсинг статей")
tab3 = ui.tab("Настройки")
with ui.tab_panels(tabs, value=tab1).classes("w-full"):
with ui.tab_panel(tab1):
@ui.refreshable
def image_processing_panel():
image_processing_page()
image_processing_panel()
with ui.tab_panel(tab2):
@ui.refreshable
def science_panel():
science_articles_page()
science_panel()
with ui.tab_panel(tab3):
settings_page(update_data_status, science_panel.refresh)
ui.run(title="ScienceHelper", favicon="./web/static/favicon.ico")