2023-04-15 14:44:32 +03:00
|
|
|
import gradio as gr
|
2023-04-15 19:36:31 +03:00
|
|
|
from processing.stacking import stacking
|
2023-04-16 08:51:33 +03:00
|
|
|
import sys
|
|
|
|
import importlib
|
|
|
|
import pathlib
|
|
|
|
import os
|
|
|
|
import copy
|
|
|
|
from tabs import tabs
|
|
|
|
|
|
|
|
tabs_dir = pathlib.Path(__file__).parent / "tabs"
|
|
|
|
|
|
|
|
|
|
|
|
all_tabs = []
|
|
|
|
tab = None
|
|
|
|
for tab_name in tabs:
|
|
|
|
old_path = copy.deepcopy(sys.path)
|
|
|
|
sys.path = [os.path.join(tabs_dir, tab_name)] + sys.path
|
|
|
|
try:
|
|
|
|
if tab is None:
|
|
|
|
tab = importlib.import_module(f"app")
|
|
|
|
else:
|
|
|
|
tab = importlib.reload(tab)
|
|
|
|
all_tabs.append((tab_name, tab.app))
|
|
|
|
|
|
|
|
except Exception as e:
|
2023-04-16 09:55:33 +03:00
|
|
|
print(f"Error loading tab ({tab_name}): {e}")
|
2023-04-15 14:44:32 +03:00
|
|
|
|
|
|
|
with gr.Blocks() as app:
|
2023-04-16 08:51:33 +03:00
|
|
|
for tab_name, tab in all_tabs:
|
|
|
|
with gr.Tab(tab_name):
|
|
|
|
tab.render()
|
2023-04-15 14:44:32 +03:00
|
|
|
|
|
|
|
|
|
|
|
app.launch()
|