mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-18 15:44:36 +00:00
Begin work on voice conversion model upload page
This commit is contained in:
1 parent
34c0f44a33
commit
a188c5ffc6
3 files changed
+202
-1
No files matched your search
@@ -70,6 +70,7 @@ import { TrumpTtsPage } from "./pages/character/trump/TrumpTtsPage";
|
||||
import { InferenceJob } from "@storyteller/components/src/jobs/InferenceJob";
|
||||
//import { LandingPage } from "./pages/landing/LandingPage";
|
||||
import { VcModelListPage } from "./pages/vc/vc_model_list/VcModelListPage";
|
||||
import { UploadVoiceConversionModel } from "./pages/upload/UploadVoiceConversionModel";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -374,6 +375,14 @@ class PageContainer extends React.Component<Props, State> {
|
||||
/>
|
||||
</Route>
|
||||
|
||||
<Route path="/upload/voice_conversion">
|
||||
<UploadVoiceConversionModel
|
||||
sessionWrapper={this.props.sessionWrapper}
|
||||
voiceConversionModelUploadJobs={[]}
|
||||
enqueueVoiceConversionModelUploadJob={this.props.enqueueTtsModelUploadJob}
|
||||
/>
|
||||
</Route>
|
||||
|
||||
<Route path="/upload/vocoder" exact={true}>
|
||||
<UploadVocoderPage
|
||||
sessionWrapper={this.props.sessionWrapper}
|
||||
|
||||
@@ -14,12 +14,15 @@ import {
|
||||
faTags,
|
||||
faHandsHelping,
|
||||
faChartArea,
|
||||
faMicrophoneAlt,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { motion } from "framer-motion";
|
||||
import { container, item, panel } from "../../../../data/animation";
|
||||
import { usePrefixedDocumentTitle } from "../../../../common/UsePrefixedDocumentTitle";
|
||||
import { PageHeader } from "../../_common/PageHeader";
|
||||
import { faHandHoldingHeart } from "@fortawesome/pro-solid-svg-icons";
|
||||
import { faMicrophone, faMicrophoneStand } from "@fortawesome/pro-duotone-svg-icons";
|
||||
import { faWaveformLines } from "@fortawesome/pro-regular-svg-icons";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -93,6 +96,12 @@ function ContributeIndexPage(props: Props) {
|
||||
</Trans>
|
||||
</p>
|
||||
<div className="row gx-3 gy-3">
|
||||
<div className="col-12 col-md-6">
|
||||
<Link to="/upload/voice_conversion" className="btn btn-primary w-100">
|
||||
<FontAwesomeIcon icon={faMicrophoneStand} className="me-3" />
|
||||
Upload Voice Conversion Model
|
||||
</Link>
|
||||
</div>
|
||||
<div className="col-12 col-md-6">
|
||||
<Link to="/upload/tts" className="btn btn-primary w-100">
|
||||
<FontAwesomeIcon icon={faVolumeHigh} className="me-3" />
|
||||
@@ -101,7 +110,7 @@ function ContributeIndexPage(props: Props) {
|
||||
</div>
|
||||
<div className="col-12 col-md-6">
|
||||
<Link to="/upload/vocoder" className="btn btn-primary w-100">
|
||||
<FontAwesomeIcon icon={faChartArea} className="me-3" />
|
||||
<FontAwesomeIcon icon={faWaveformLines} className="me-3" />
|
||||
Upload Vocoder
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
import React, { useState } from "react";
|
||||
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
|
||||
import { DiscordLink } from "@storyteller/components/src/elements/DiscordLink";
|
||||
import {
|
||||
EnqueueRemoteDownload,
|
||||
EnqueueRemoteDownloadIsOk,
|
||||
} from "@storyteller/components/src/api/remote_downloads/EnqueueRemoteDownload";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { BackLink } from "../../_common/BackLink";
|
||||
import { Link } from "react-router-dom";
|
||||
import { WebUrl } from "../../../../common/WebUrl";
|
||||
import { motion } from "framer-motion";
|
||||
import { container, item, panel } from "../../../../data/animation";
|
||||
import { VocoderUploadJob } from "@storyteller/components/src/jobs/VocoderUploadJobs";
|
||||
import { SessionVocoderUploadResultList } from "../../_common/SessionVocoderUploadResultsList";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faMicrophoneStand } from "@fortawesome/pro-solid-svg-icons";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
enqueueVoiceConversionModelUploadJob: (jobToken: string) => void;
|
||||
voiceConversionModelUploadJobs: Array<number>; // TODO
|
||||
}
|
||||
|
||||
function UploadVoiceConversionModel(props: Props) {
|
||||
let history = useHistory();
|
||||
|
||||
const [downloadUrl, setDownloadUrl] = useState("");
|
||||
const [title, setTitle] = useState("");
|
||||
const [downloadUrlInvalidReason] = useState("");
|
||||
const [titleInvalidReason] = useState("");
|
||||
|
||||
if (!props.sessionWrapper.isLoggedIn()) {
|
||||
return (
|
||||
<div className="container py-5">
|
||||
<div className="py-5">
|
||||
<h1 className="fw-semibold text-center mb-4">
|
||||
You need to create an account or log in.
|
||||
</h1>
|
||||
<div className="d-flex gap-3 justify-content-center">
|
||||
<Link className="btn btn-secondary" to="/login">
|
||||
Login
|
||||
</Link>
|
||||
<Link className="btn btn-primary" to="/signup">
|
||||
Sign Up
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const handleDownloadUrlChange = (ev: React.FormEvent<HTMLInputElement>) => {
|
||||
ev.preventDefault();
|
||||
const downloadUrlValue = (ev.target as HTMLInputElement).value;
|
||||
setDownloadUrl(downloadUrlValue);
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleTitleChange = (ev: React.FormEvent<HTMLInputElement>) => {
|
||||
ev.preventDefault();
|
||||
const titleValue = (ev.target as HTMLInputElement).value;
|
||||
setTitle(titleValue);
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleFormSubmit = async (ev: React.FormEvent<HTMLFormElement>) => {
|
||||
ev.preventDefault();
|
||||
|
||||
let idempotencyToken = uuidv4();
|
||||
|
||||
const request = {
|
||||
idempotency_token: idempotencyToken,
|
||||
title: title,
|
||||
download_url: downloadUrl,
|
||||
generic_download_type: "hifigan",
|
||||
};
|
||||
|
||||
const response = await EnqueueRemoteDownload(request);
|
||||
|
||||
if (EnqueueRemoteDownloadIsOk(response)) {
|
||||
props.enqueueVoiceConversionModelUploadJob(response.job_token);
|
||||
history.push("/");
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
return (
|
||||
<motion.div initial="hidden" animate="visible" variants={container}>
|
||||
<div className="container pt-5 pb-4 px-md-4 px-lg-5 px-xl-3">
|
||||
<div className="d-flex flex-column">
|
||||
<motion.h1 className=" fw-bold" variants={item}>
|
||||
Upload Voice Conversion Model
|
||||
{" "}
|
||||
<FontAwesomeIcon icon={faMicrophoneStand} className="me-3" />
|
||||
</motion.h1>
|
||||
<motion.h4 variants={item}>Transform your voice into another!</motion.h4>
|
||||
<motion.div className="my-3" variants={item}>
|
||||
<BackLink
|
||||
link={WebUrl.contributePage()}
|
||||
text="Back to contribute page"
|
||||
/>
|
||||
</motion.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<motion.div
|
||||
className="container pt-3 d-flex flex-column gap-3 px-md-4 px-lg-5 px-xl-3"
|
||||
variants={item}
|
||||
>
|
||||
<p>
|
||||
If you're new to voice cloning, join our{" "}
|
||||
<span>
|
||||
<DiscordLink />
|
||||
</span>{" "}
|
||||
to get started. We have a friendly community that can help you start
|
||||
creating your own voices of your favorite characters.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Once your voice conversion model is successfully uploaded, you'll be
|
||||
able to use it from the main page. Others will be able to use it too,
|
||||
and you'll get credited.
|
||||
</p>
|
||||
</motion.div>
|
||||
|
||||
<motion.form onSubmit={handleFormSubmit} variants={panel}>
|
||||
<div className="container-panel py-5">
|
||||
<div className="panel p-3 py-4 p-lg-4">
|
||||
<div className="d-flex flex-column gap-4">
|
||||
<div>
|
||||
<label className="sub-title">
|
||||
Voice Conversion Title, eg. "Jim Varney", "Donald Trump", etc.
|
||||
</label>
|
||||
<div className="form-group">
|
||||
<input
|
||||
className="form-control"
|
||||
type="text"
|
||||
placeholder="Title"
|
||||
value={title}
|
||||
onChange={handleTitleChange}
|
||||
/>
|
||||
</div>
|
||||
<p className="help">{titleInvalidReason}</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="sub-title">
|
||||
Download URL, eg. Google Drive link
|
||||
</label>
|
||||
<div className="form-group">
|
||||
<input
|
||||
className="form-control"
|
||||
type="text"
|
||||
placeholder="Download URL"
|
||||
value={downloadUrl}
|
||||
onChange={handleDownloadUrlChange}
|
||||
/>
|
||||
</div>
|
||||
<p className="help">{downloadUrlInvalidReason}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<motion.div className="container pb-5" variants={item}>
|
||||
<button className="btn btn-primary w-100">Upload</button>
|
||||
</motion.div>
|
||||
</motion.form>
|
||||
|
||||
|
||||
{/*
|
||||
<SessionVocoderUploadResultList
|
||||
vocoderUploadJobs={props.vocoderUploadJobs}
|
||||
/>
|
||||
*/}
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
export { UploadVoiceConversionModel };
|
||||
Reference in new issue
Block a user