mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 09:28:11 +00:00
use with lipsync cta above animate button when output is available
This commit is contained in:
1 parent
019f4bc168
commit
0a1e57f5da
3 files changed
+86
-49
No files matched your search
@@ -559,7 +559,7 @@ export default function Lipsync({ sessionSubscriptionsWrapper }: LipsyncProps) {
|
||||
theme="fakeyou"
|
||||
content={
|
||||
generatedVideoSrc
|
||||
? t("tooltip.downloadVideo")
|
||||
? t("tooltip.download")
|
||||
: t("tooltip.downloadNoOutput")
|
||||
}
|
||||
>
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
faArrowDownToLine,
|
||||
faEquals,
|
||||
faImageUser,
|
||||
faLips,
|
||||
faLock,
|
||||
faPlus,
|
||||
faSparkles,
|
||||
@@ -129,6 +130,9 @@ export default function LivePortrait({
|
||||
const [isGenerating, setIsGenerating] = useState(false);
|
||||
const [generatedVideos, setGeneratedVideos] = useState<GeneratedVideo[]>([]);
|
||||
const [jobProcessedTokens, setJobProcessedTokens] = useState<string[]>([]);
|
||||
const [resultTokens, setResultTokens] = useState<{
|
||||
[key: string]: string | null;
|
||||
}>({});
|
||||
const [currentlyGeneratingList, setCurrentlyGeneratingList] = useState<
|
||||
CurrentlyGenerating[]
|
||||
>([]);
|
||||
@@ -579,6 +583,16 @@ export default function LivePortrait({
|
||||
livePortraitDetails.face_driver_media_file_token
|
||||
);
|
||||
|
||||
const sourceToken = livePortraitDetails.source_media_file_token;
|
||||
const motionToken = livePortraitDetails.face_driver_media_file_token;
|
||||
|
||||
const combinationKey = `${sourceToken}_${motionToken}`;
|
||||
|
||||
setResultTokens(prevTokens => ({
|
||||
...prevTokens,
|
||||
[combinationKey]: maybeResultToken,
|
||||
}));
|
||||
|
||||
const newGeneratedVideo = {
|
||||
sourceIndex,
|
||||
motionIndex,
|
||||
@@ -840,6 +854,8 @@ export default function LivePortrait({
|
||||
</>
|
||||
);
|
||||
|
||||
const combinationKey = `${sourceTokens[selectedSourceIndex]}_${motionTokens[selectedMotionIndex]}`;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container type="panel" className="mt-3 mt-lg-5">
|
||||
@@ -951,42 +967,62 @@ export default function LivePortrait({
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-column gap-4">
|
||||
<div className="d-flex gap-2">
|
||||
<Button
|
||||
icon={isUserContent ? faSparkles : undefined}
|
||||
label={
|
||||
!loggedIn && isUserContent
|
||||
? "Sign Up and Animate"
|
||||
: isUserContent
|
||||
? generatedVideoSrc
|
||||
? "Re-animate"
|
||||
: "Animate"
|
||||
: !loggedIn
|
||||
? "Sign up now to Animate"
|
||||
: "Upload your media to generate"
|
||||
}
|
||||
onClick={
|
||||
loggedIn
|
||||
? enqueueClick
|
||||
: () =>
|
||||
history.push("/signup?redirect=/ai-live-portrait")
|
||||
}
|
||||
className="flex-grow-1"
|
||||
// disabled={!isUserContent}
|
||||
isLoading={isEnqueuing || isGenerating}
|
||||
disabled={!isUserContent && loggedIn}
|
||||
/>
|
||||
<Tippy theme="fakeyou" content="Download video">
|
||||
<div>
|
||||
<Button
|
||||
square={true}
|
||||
icon={faArrowDownToLine}
|
||||
variant="action"
|
||||
onClick={handleDownloadClick}
|
||||
disabled={!loggedIn}
|
||||
/>
|
||||
</div>
|
||||
</Tippy>
|
||||
<div className="d-flex flex-column gap-3">
|
||||
{generatedVideoSrc && resultTokens[combinationKey] && (
|
||||
<Button
|
||||
icon={faLips}
|
||||
label="Use with Lipsync"
|
||||
onClick={() =>
|
||||
history.push(
|
||||
`/ai-lip-sync?source=${resultTokens[combinationKey]}`
|
||||
)
|
||||
}
|
||||
className="flex-grow-1"
|
||||
variant="primary"
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="d-flex gap-2">
|
||||
<Button
|
||||
icon={isUserContent ? faSparkles : undefined}
|
||||
label={
|
||||
!loggedIn && isUserContent
|
||||
? "Sign Up and Animate"
|
||||
: isUserContent
|
||||
? generatedVideoSrc
|
||||
? "Re-animate"
|
||||
: "Animate"
|
||||
: !loggedIn
|
||||
? "Sign up now to Animate"
|
||||
: "Upload your media to generate"
|
||||
}
|
||||
onClick={
|
||||
loggedIn
|
||||
? enqueueClick
|
||||
: () =>
|
||||
history.push(
|
||||
"/signup?redirect=/ai-live-portrait"
|
||||
)
|
||||
}
|
||||
className="flex-grow-1"
|
||||
// disabled={!isUserContent}
|
||||
isLoading={isEnqueuing || isGenerating}
|
||||
disabled={!isUserContent && loggedIn}
|
||||
variant={generatedVideoSrc ? "action" : "primary"}
|
||||
/>
|
||||
|
||||
<Tippy theme="fakeyou" content="Download video">
|
||||
<div>
|
||||
<Button
|
||||
square={true}
|
||||
icon={faArrowDownToLine}
|
||||
variant="action"
|
||||
onClick={handleDownloadClick}
|
||||
disabled={!loggedIn}
|
||||
/>
|
||||
</div>
|
||||
</Tippy>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="d-flex flex-column gap-2">
|
||||
|
||||
+13
-12
@@ -250,18 +250,19 @@ export default function SessionLpInferenceResultsList({
|
||||
className="pe-2 fs-5 opacity-75"
|
||||
/>
|
||||
</div>
|
||||
{job.maybeResultToken && (
|
||||
<Button
|
||||
icon={faLips}
|
||||
label="Use with Lip Sync"
|
||||
small={true}
|
||||
onClick={e => {
|
||||
if (job.maybeResultToken !== null) {
|
||||
handleLipsyncCTA(e, job.maybeResultToken);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Button
|
||||
icon={faLips}
|
||||
label="Use with Lip Sync"
|
||||
small={true}
|
||||
variant={job.maybeResultToken ? "primary" : "action"}
|
||||
disabled={!job.maybeResultToken}
|
||||
onClick={e => {
|
||||
if (job.maybeResultToken !== null) {
|
||||
handleLipsyncCTA(e, job.maybeResultToken);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user