diff --git a/packages/fakeyou.com/src/hooks/useLoraUpload/index.ts b/packages/fakeyou.com/src/hooks/useLoraUpload/index.ts new file mode 100644 index 0000000000..4705121933 --- /dev/null +++ b/packages/fakeyou.com/src/hooks/useLoraUpload/index.ts @@ -0,0 +1 @@ +export { default } from "./useLoraUpload"; diff --git a/packages/fakeyou.com/src/hooks/useLoraUpload/useLoraUpload.tsx b/packages/fakeyou.com/src/hooks/useLoraUpload/useLoraUpload.tsx new file mode 100644 index 0000000000..bfbe37ac7b --- /dev/null +++ b/packages/fakeyou.com/src/hooks/useLoraUpload/useLoraUpload.tsx @@ -0,0 +1,59 @@ +import { useState } from "react"; +import { UploadModel } from "@storyteller/components/src/api/image_generation/UploadModel"; +import { FetchStatus } from "@storyteller/components/src/api/_common/SharedFetchTypes"; +import { useCoverImgUpload } from "hooks"; +import { v4 as uuidv4 } from "uuid"; + +// this hook is mostly for organizational purposes while I work -V + +export default function useLoraUpload() { + const [title, titleSet] = useState(""); + const [uploadPath, uploadPathSet] = useState(""); + const [visibility, visibilitySet] = useState("public"); + const [descriptionMD, descriptionMDSet] = useState(""); + const [writeStatus, writeStatusSet] = useState(FetchStatus.paused); + const coverImg = useCoverImgUpload(); + + const onChange = ({ target }: { target: { name: string; value: any } }) => { + const todo: { [key: string]: (x: any) => void } = { + descriptionMDSet, + uploadPathSet, + titleSet, + visibilitySet, + }; + todo[target.name + "Set"](target.value); + }; + + const upload = () => { + writeStatusSet(FetchStatus.in_progress); + UploadModel("", { + ...(coverImg.token + ? { cover_image_media_file_token: coverImg.token } + : {}), + description: descriptionMD, + uuid_idempotency_token: uuidv4(), + type_of_inference: "inference", + maybe_upload_path: uploadPath, + title, + visibility, + }) + .then((res: any) => { + writeStatusSet(FetchStatus.success); + console.log("🌠", res); + // history.replace(`/weight/${token}`); + }) + .catch(err => { + writeStatusSet(FetchStatus.error); + }); + }; + return { + coverImg, + descriptionMD, + onChange, + title, + upload, + uploadPath, + visibility, + writeStatus, + }; +} diff --git a/packages/fakeyou.com/src/v2/view/PageContainer.tsx b/packages/fakeyou.com/src/v2/view/PageContainer.tsx index 48c683e656..356321522b 100644 --- a/packages/fakeyou.com/src/v2/view/PageContainer.tsx +++ b/packages/fakeyou.com/src/v2/view/PageContainer.tsx @@ -107,6 +107,7 @@ import WeightEditPage from "./pages/weight/WeightEditPage"; import UploadSdWeightPage from "./pages/upload/UploadSdWeightPage"; import { FooterNav } from "./nav/FooterNav"; import FbxToGltfPage from "./pages/fbx_to_gltf/FbxToGltfPage"; +import UploadLoraWeightPage from "./pages/upload/UploadLoraWeightPage"; interface Props { sessionWrapper: SessionWrapper; @@ -349,12 +350,6 @@ class PageContainer extends React.Component< /> - - - - @@ -543,6 +538,18 @@ class PageContainer extends React.Component< /> + + + + + + + +
- - - Upload Voice to Voice Model - + />
- - - {t("pages.contributeIndex.buttonUploadVoice")} - +
- - - Upload Vocoder - +
+
+
+
+
diff --git a/packages/fakeyou.com/src/v2/view/pages/upload/UploadLoraWeightPage.tsx b/packages/fakeyou.com/src/v2/view/pages/upload/UploadLoraWeightPage.tsx new file mode 100644 index 0000000000..e13037dfa9 --- /dev/null +++ b/packages/fakeyou.com/src/v2/view/pages/upload/UploadLoraWeightPage.tsx @@ -0,0 +1,149 @@ +import React from "react"; +import { + faCircleExclamation, + faEye, + faWaveform, +} from "@fortawesome/pro-solid-svg-icons"; +import { usePrefixedDocumentTitle } from "common/UsePrefixedDocumentTitle"; +import PageHeader from "components/layout/PageHeader"; +import { + Button, + Container, + CoverImageInput, + SplitPanel, + TempInput, + TempSelect, + TempTextArea, +} from "components/common"; +import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper"; +import useLoraUpload from "hooks/useLoraUpload"; + +interface UploadLoraWeightPageProps { + sessionWrapper: SessionWrapper; +} + +export default function UploadLoraWeightPage({ + sessionWrapper, +}: UploadLoraWeightPageProps) { + usePrefixedDocumentTitle("Edit Voice"); + + const visibilityOptions = [ + { label: "Public", value: "public" }, + { label: "Private", value: "private" }, + ]; + + const { + coverImg, + descriptionMD, + onChange, + title, + upload, + uploadPath, + visibility, + } = useLoraUpload(); + + if (!sessionWrapper.isLoggedIn()) { + return ( + + +