const os = require('os') const fs = require('fs') const path = require("path") const exists = (filepath) => { return new Promise(r=>fs.access(filepath, fs.constants.F_OK, e => r(!e))) } module.exports = { title: "XTTS", description: "clone voices into different languages by using just a quick 3-second audio clip. (a local version of https://huggingface.co/spaces/coqui/xtts)", icon: "icon.png", menu: async (kernel) => { let installed = await exists(path.resolve(__dirname, "env")) if (installed) { let session = (await kernel.loader.load(path.resolve(__dirname, "session.json"))).resolved return [{ when: "start.json", on: " Running", type: "label", href: "start.json" }, { when: "start.json", off: " Launch", href: "start.json?fullscreen=true&run=true", }, { when: "start.json", on: (session && session.url ? " Open Web UI" : null), href: (session && session.url ? session.url : null), target: "_blank" }, { when: "start.json", on: " Server", href: "start.json?fullscreen=true" }] } else { return [{ html: ' Install', type: "link", href: "install.json?run=true&fullscreen=true" }] } } }