This commit is contained in:
josc146
2023-05-17 21:20:41 +08:00
parent 11813454de
commit df8eef5f64
14 changed files with 438 additions and 121 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"time"
@@ -97,9 +98,13 @@ func (a *App) DownloadFile(path string, url string) error {
}
func (a *App) OpenFileFolder(path string) error {
absPath, err := filepath.Abs(path)
if err != nil {
return err
}
switch os := runtime.GOOS; os {
case "windows":
cmd := exec.Command("explorer", "/select,", path)
cmd := exec.Command("explorer", "/select,", absPath)
err := cmd.Run()
if err != nil {
return err

View File

@@ -18,3 +18,16 @@ func (a *App) StartServer(port int) (string, error) {
}
return string(out), nil
}
func (a *App) ConvertModel(modelPath string, strategy string, outPath string) (string, error) {
cmdHelper, err := filepath.Abs("./cmd-helper")
if err != nil {
return "", err
}
cmd := exec.Command(cmdHelper, "python", "./backend-python/convert_model.py", "--in", modelPath, "--out", outPath, "--strategy", strategy)
out, err := cmd.CombinedOutput()
if err != nil {
return "", err
}
return string(out), nil
}