from fastapi import FastAPI
import uvicorn
from nicegui import ui
class PipRequirement:
def __init__(self):
ui.label("依赖安装与依赖展示")
class BasicSettings:
def __init__(self):
self.project_select = ui.select(["test"], label="项目选择").props('filled color=green')
ui.separator()
self.model_name = ui.input(placeholder="yolov5", label="模型名称").props('filled color=green')
self.model_name_on_jfrog = ui.input(placeholder="yolov5-op13-fp32", label="模型jfrog名称").props(
'filled color=green')
self.model_name_on_xnas = ui.input(placeholder="pytorch_model_tops_engine.bin", label="模型xnas名称").props(
'filled color=green')
self.jfrog_dir = ui.input(
placeholder="enflame_model_zoo/official/aigc/xx/xx",
label="模型jfrog上传onnx的路径").props('filled color=green')
self.xnas_dir = ui.input(placeholder="inference/algo_test/xx/xx", label="模型xnas上传engine的路径").props(
'filled color=green')
self.save_btn = ui.button("保存基本配置").props('inline color=green').style(
"width: 100%;")
self.clone_btn = ui.button("从当前项目中克隆出新项目").props('inline color=green').style(
"width: 100%;")
class ModelInstance:
def __init__(self):
example = """
from controlnet_aux import LineartDetector\n
model = LineartDetector.from_pretrained("lllyasviel/Annotators").model
"""
project_select = ui.select(["test"], label="项目选择").props('filled color=green')
ui.separator()
with ui.label("示例代码参考"):
ui.code(content=example)
editor = ui.editor(placeholder='# 请在这里写模型实例,要求必须含有model')
save_btn = ui.button("保存模型实例").style(
"width: 100%;")
class MainPage:
def __init__(self):
with ui.header() \
.style('box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1)'):
with ui.row().classes('max-[1050px]:hidden'):
ui.button("重置数据").props("text").classes(replace='text-lg text-white')
ui.button("ai 模型转换可视化工具").classes(replace='text-lg text-white').disable()
with ui.tabs().classes('w-full') as tabs:
basic_settings_ = ui.tab('基本设置')
model_instance_ = ui.tab('模型实例配置')
model_onnx_export_ = ui.tab('模型导出onnx')
model_onnx_topsideas_ = ui.tab('模型onnx精度验证topsideas')
model_onnx_build_engine_ = ui.tab('模型onnx编图engine')
model_onnx_upload_ = ui.tab('模型onn及weight上传jfrog以及开发者文档上传')
model_engine_upload_ = ui.tab('模型engine上传xnas')
env_data_ = ui.tab('环境依赖展示')
with ui.tab_panels(tabs, value=basic_settings_).classes(
'w-full h-full') as tab_panels:
with ui.tab_panel(basic_settings_):
BasicSettings()
with ui.tab_panel(model_instance_):
ModelInstance()
with ui.tab_panel(model_onnx_export_):
ui.label('model_onnx_export tab')
with ui.tab_panel(model_onnx_topsideas_):
ui.label('model_onnx_test tab')
with ui.tab_panel(model_onnx_build_engine_):
ui.label('model_onnx_test tab')
with ui.tab_panel(model_onnx_upload_):
ui.label('model_onnx_test tab')
with ui.tab_panel(model_engine_upload_):
ui.label('model_onnx_test tab')
with ui.tab_panel(env_data_):
ui.label('model_onnx_test tab')
MainPage()
ui.run(reload=False)
```
- 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