File size: 588 Bytes
010bc6c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1ed7f3
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

import importlib.util
from pathlib import Path

ROOT = Path(__file__).resolve().parent
SOURCE = ROOT / 'apps' / 'gradio-demo' / 'app' / 'main.py'

spec = importlib.util.spec_from_file_location('naturalcad_gradio_main', SOURCE)
if spec is None or spec.loader is None:
    raise RuntimeError(f'Could not load NaturalCAD app from {SOURCE}')

module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)

demo = module.build_ui()

if __name__ == '__main__':
    demo.launch(
        server_name='0.0.0.0',
        server_port=7860,
    )