From 448501d83c2f171ae342277da6cf98577617e920 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 30 Apr 2024 12:13:02 -0700 Subject: [PATCH 1/9] added clip length to /style-video --- .../v2/view/pages/style-video/StyleVideo.tsx | 144 ++++++++++++------ 1 file changed, 96 insertions(+), 48 deletions(-) diff --git a/packages/fakeyou.com/src/v2/view/pages/style-video/StyleVideo.tsx b/packages/fakeyou.com/src/v2/view/pages/style-video/StyleVideo.tsx index 398d4283cb..43be8c4455 100644 --- a/packages/fakeyou.com/src/v2/view/pages/style-video/StyleVideo.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/style-video/StyleVideo.tsx @@ -2,11 +2,18 @@ import React, { useState } from "react"; import { FrontendInferenceJobType } from "@storyteller/components/src/jobs/InferenceJob"; import { v4 as uuidv4 } from "uuid"; import { useInferenceJobs, useSession } from "hooks"; -import { Button, Container, Panel, TextArea, TempSelect as Select } from "components/common"; +import { + Button, + Container, + Panel, + SegmentButtons, + TextArea, + TempSelect as Select, +} from "components/common"; import { EntityInput } from "components/entities"; import { EnqueueVST, - EnqueueVSTResponse + EnqueueVSTResponse, } from "@storyteller/components/src/api/video_styleTransfer/Enqueue_VST"; import "./StyleVideo.scss"; import { useParams } from "react-router-dom"; @@ -19,24 +26,28 @@ export default function StyleVideo() { const [mediaToken, mediaTokenSet] = useState(pageMediaToken || ""); const [prompt, promptSet] = useState(""); const [negativePrompt, negativePromptSet] = useState(""); + const [length, lengthSet] = useState(3000); const { enqueue } = useInferenceJobs(); const onClick = () => { if (mediaToken) { - EnqueueVST("",{ + EnqueueVST("", { creator_set_visibility: "private", enable_lipsync: true, input_file: mediaToken, negative_prompt: negativePrompt, prompt, style, - trim_end_millis: 3000, + trim_end_millis: length, trim_start_millis: 0, - uuid_idempotency_token: uuidv4() - }) - .then((res: EnqueueVSTResponse) => { + uuid_idempotency_token: uuidv4(), + }).then((res: EnqueueVSTResponse) => { if (res.success && res.inference_job_token) { - enqueue(res.inference_job_token,true,FrontendInferenceJobType.VideoStyleTransfer); + enqueue( + res.inference_job_token, + true, + FrontendInferenceJobType.VideoStyleTransfer + ); } else { console.log("Failed to enqueue job", res); } @@ -44,55 +55,92 @@ export default function StyleVideo() { } }; - const options = STYLE_OPTIONS.map((option) => { + const styleOptions = STYLE_OPTIONS.map(option => { return { - label: option.label, + label: option.label, value: option.value, - } + }; }); - return studioAccessCheck( + const lengthOptions = [ + { label: 3, value: 3000 }, + { label: 5, value: 5000 }, + { label: 7, value: 7000 }, + ]; + + return studioAccessCheck( +
-

- Style a Video -

+

Style a Video

- { mediaTokenSet(target.value) }, - type: "media" - }}/> - { + styleSet(target.value); + }, + options: styleOptions, + value: style, + }} + />
-