mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-20 08:35:29 +00:00
Merge branch 'feature/mvp' into feature/comp/playbar-w-trim
This commit is contained in:
commit
f3595993b3
35 files changed
+641
-277
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import MakeRequest from "../MakeRequest";
|
||||
import { UserDetailsLight } from "../_common/UserDetailsLight";
|
||||
|
||||
export interface RequestDetails {
|
||||
inference_category: string,
|
||||
maybe_model_type?: string,
|
||||
maybe_model_token?: string,
|
||||
maybe_model_title?: string,
|
||||
maybe_raw_inference_text?: string,
|
||||
}
|
||||
|
||||
export interface StatusDetails {
|
||||
status: string,
|
||||
maybe_extra_status_description?: string,
|
||||
maybe_failure_category?: string,
|
||||
attempt_count: number,
|
||||
}
|
||||
|
||||
export interface ResultDetails {
|
||||
entity_type: string,
|
||||
entity_token: string,
|
||||
maybe_public_bucket_media_path?: string,
|
||||
}
|
||||
|
||||
export interface JobStatus {
|
||||
job_token: string,
|
||||
request: RequestDetails,
|
||||
status: StatusDetails,
|
||||
maybe_result?: ResultDetails,
|
||||
created_at: Date,
|
||||
updated_at: Date,
|
||||
}
|
||||
|
||||
export interface GetJobStatusRequest {}
|
||||
|
||||
export interface GetJobStatusResponse {
|
||||
success: boolean;
|
||||
state: JobStatus
|
||||
}
|
||||
|
||||
export const GetJobStatus = MakeRequest<string,GetJobStatusRequest,GetJobStatusResponse,{}>({
|
||||
method: "GET",
|
||||
routingFunction: (jobToken: string) =>`/v1/model_inference/job_status/${jobToken}`,
|
||||
});
|
||||
@@ -9,7 +9,6 @@ interface Props {
|
||||
}
|
||||
|
||||
export default function WeightsCards({ props, type }: Props) {
|
||||
console.log(props);
|
||||
switch (type) {
|
||||
case WeightCategory.TTS:
|
||||
case WeightCategory.VC:
|
||||
|
||||
@@ -6,15 +6,21 @@
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: rgba($white, 0.8);
|
||||
color: rgba($white, 0.8) !important;
|
||||
transition: 0.15s all;
|
||||
|
||||
a {
|
||||
color: rgba($white, 0.8);
|
||||
color: rgba($white, 0.8) !important;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
font-weight: 500 !important;
|
||||
transition: 0.15s all;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
a {
|
||||
color: $white !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fy-nav-item:hover .fy-dropdown-menu {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function NavItem({
|
||||
}: NavItemProps) {
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
|
||||
const textHover = `${isHovered && "text-white"}`.trim();
|
||||
const textHover = `${isHovered ? "text-white" : ""}`.trim();
|
||||
|
||||
const renderContent = () => {
|
||||
if (isHoverable && dropdownItems) {
|
||||
|
||||
@@ -13,6 +13,7 @@ $playbar-height: 2rem;
|
||||
}
|
||||
.fy-video {
|
||||
max-height: 500px;
|
||||
width: 100%;
|
||||
margin-bottom: -7px;
|
||||
|
||||
video {
|
||||
|
||||
@@ -27,9 +27,11 @@ import NumberSliderV2 from "./NumberSliderV2";
|
||||
import Pagination from "./Pagination";
|
||||
import Panel from "./Panel";
|
||||
import Radio from "./Radio";
|
||||
import Scene3D from "./Scene3D";
|
||||
import Searcher from "./Searcher";
|
||||
import SegmentButtons from "./SegmentButtons";
|
||||
import Select from "./Select";
|
||||
import SelectionBubbles from "./SelectionBubbles";
|
||||
import SelectModal, { SelectModalData } from "./SelectModal";
|
||||
import SelectModalVideoTabs from "./SelectModalVideoTabs";
|
||||
import SelectModalWeightsTabs from "./SelectModalWeightsTabs";
|
||||
@@ -49,9 +51,7 @@ import VideoBasic from "./VideoBasic";
|
||||
import VideoFakeyou from "./VideoFakeyou";
|
||||
import VideoInput from "./VideoInput";
|
||||
// import VideoQuickTrim, {QuickTrimType} from "./VideoQuickTrim";
|
||||
import SelectionBubbles from "./SelectionBubbles";
|
||||
import Scene3D from "./Scene3D";
|
||||
|
||||
import WeightCoverImage from "./WeightCoverImage";
|
||||
export type { SelectModalData };
|
||||
|
||||
export {
|
||||
@@ -89,9 +89,11 @@ export {
|
||||
Pagination,
|
||||
Panel,
|
||||
Radio,
|
||||
Scene3D,
|
||||
SegmentButtons,
|
||||
Searcher,
|
||||
Select,
|
||||
SelectionBubbles,
|
||||
SelectModal,
|
||||
SelectModalVideoTabs,
|
||||
SelectModalWeightsTabs,
|
||||
@@ -110,7 +112,6 @@ export {
|
||||
VideoBasic,
|
||||
VideoFakeyou,
|
||||
VideoInput,
|
||||
WeightCoverImage,
|
||||
// VideoQuickTrim,
|
||||
SelectionBubbles,
|
||||
Scene3D,
|
||||
};
|
||||
@@ -2,7 +2,7 @@ import React from "react";
|
||||
import { Badge } from "components/common";
|
||||
|
||||
export default function CardBadge(props: any) {
|
||||
return <div className="d-flex align-items-center">
|
||||
return <div className="fy-card-badge align-items-center">
|
||||
<div className="d-flex flex-grow-1">
|
||||
<Badge {...props} />
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import AudioCard from "./AudioCard";
|
||||
import CardBadge from "./CardBadge";
|
||||
import CardFooter from "./CardFooter";
|
||||
import CardWrapper from "./CardWrapper";
|
||||
import EntityInput from "./EntityInput";
|
||||
@@ -6,4 +7,4 @@ import MediaList from "./MediaList";
|
||||
import OverlayCard from "./OverlayCard";
|
||||
import WeightCard from "./WeightCard";
|
||||
|
||||
export { AudioCard, CardFooter, CardWrapper, EntityInput, MediaList, OverlayCard, WeightCard };
|
||||
export { AudioCard, CardBadge, CardFooter, CardWrapper, EntityInput, MediaList, OverlayCard, WeightCard };
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
faWaveformLines,
|
||||
faTransporter,
|
||||
faClipboardList,
|
||||
faFilm,
|
||||
} from "@fortawesome/pro-solid-svg-icons";
|
||||
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
|
||||
import { FakeYouFrontendEnvironment } from "@storyteller/components/src/env/FakeYouFrontendEnvironment";
|
||||
@@ -231,9 +232,20 @@ export default function SideNav({
|
||||
let maybeBetaFeatures = <></>;
|
||||
|
||||
if (sessionWrapper.canAccessStudio()) {
|
||||
maybeBetaFeatures= (
|
||||
maybeBetaFeatures = (
|
||||
<>
|
||||
<li className="sidebar-heading">Beta Features</li>
|
||||
<li>
|
||||
<NavLink
|
||||
to="/studio-intro/m_ejhs95fc5aybp36h4a79k7523ds6an"
|
||||
activeClassName="active-link"
|
||||
onClick={handleNavLinkClick}
|
||||
>
|
||||
<FontAwesomeIcon icon={faFilm} className="sidebar-heading-icon" />
|
||||
Storyteller Onboarding
|
||||
{/* {t("videoStorytellerStudio")} */}
|
||||
</NavLink>
|
||||
</li>
|
||||
<li>
|
||||
<NavLink
|
||||
to="/video-mocap"
|
||||
@@ -420,7 +432,10 @@ export default function SideNav({
|
||||
activeClassName="active-link"
|
||||
onClick={handleNavLinkClick}
|
||||
>
|
||||
<FontAwesomeIcon icon={faFilms} className="sidebar-heading-icon" />
|
||||
<FontAwesomeIcon
|
||||
icon={faFilms}
|
||||
className="sidebar-heading-icon"
|
||||
/>
|
||||
{t("videoStyleTransfer")}
|
||||
</NavLink>
|
||||
</li>
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.fy-input {
|
||||
margin-bottom: 0;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.icon-close-button {
|
||||
cursor: pointer;
|
||||
height: 1.5rem;
|
||||
|
||||
@@ -7,10 +7,10 @@ import SkeletonCard from "components/common/Card/SkeletonCard";
|
||||
import { GetBookmarksByUser } from "@storyteller/components/src/api/bookmarks/GetBookmarksByUser";
|
||||
import { GetMediaByUser } from "@storyteller/components/src/api/media_files/GetMediaByUser";
|
||||
import { GetWeightsByUser } from "@storyteller/components/src/api/weights/GetWeightsByUser";
|
||||
import { SearchWeights } from "@storyteller/components/src/api/weights/SearchWeights";
|
||||
import { SearchWeight } from "@storyteller/components/src/api/weights/Search";
|
||||
import { MediaFile } from "@storyteller/components/src/api/media_files/GetMedia";
|
||||
import { Weight } from "@storyteller/components/src/api/weights/GetWeight";
|
||||
import { useListContent,
|
||||
import { useDebounce, useListContent,
|
||||
// useRatings
|
||||
} from "hooks";
|
||||
import { faArrowDownWideShort, faFilter } from "@fortawesome/pro-solid-svg-icons";
|
||||
@@ -18,11 +18,14 @@ import prepFilter from "resources/prepFilter";
|
||||
import ModalHeader from "../ModalHeader";
|
||||
import "./MediaBrowser.scss";
|
||||
|
||||
const n = () => {};
|
||||
|
||||
interface Props {
|
||||
accept?: AcceptTypes[],
|
||||
handleClose: any;
|
||||
inputMode: EntityInputMode;
|
||||
mediaToken: string;
|
||||
onSearchChange?: (e: any) => void;
|
||||
onSelect?: any;
|
||||
owner?: string;
|
||||
search?: string;
|
||||
@@ -32,8 +35,9 @@ interface Props {
|
||||
export default function MediaBrowser({
|
||||
accept,
|
||||
mediaToken,
|
||||
handleClose = () => {},
|
||||
handleClose = n,
|
||||
inputMode,
|
||||
onSearchChange = n,
|
||||
onSelect,
|
||||
owner,
|
||||
search,
|
||||
@@ -43,15 +47,17 @@ export default function MediaBrowser({
|
||||
const [showMasonryGrid, setShowMasonryGrid] = useState(true);
|
||||
const [filterType, filterTypeSet] = useState(accept ? accept[0] : "all");
|
||||
const [list, listSet] = useState<MediaFile | Weight[]>([]);
|
||||
const fetcher = [GetBookmarksByUser,GetMediaByUser,GetWeightsByUser,SearchWeights][inputMode];
|
||||
const [localSearch,localSearchSet] = useState(search);
|
||||
const [searchUpdated,searchUpdatedSet] = useState(false);
|
||||
const fetcher = [GetBookmarksByUser,GetMediaByUser,GetWeightsByUser,SearchWeight][inputMode];
|
||||
|
||||
const entities = useListContent({
|
||||
debug: "media browser",
|
||||
addQueries: {
|
||||
...(search ? {} : { page_size: 24 }),
|
||||
...(localSearch ? {} : { page_size: 24 }),
|
||||
...prepFilter(
|
||||
filterType,
|
||||
["maybe_scoped_weight_type", "filter_media_type", "maybe_scoped_weight_type",""][inputMode]
|
||||
["maybe_scoped_weight_type", "filter_media_type", "maybe_scoped_weight_type","abc"][inputMode]
|
||||
),
|
||||
},
|
||||
addSetters: { filterTypeSet },
|
||||
@@ -64,13 +70,28 @@ export default function MediaBrowser({
|
||||
// ratings.gather({ res, key: "token" });
|
||||
setShowMasonryGrid(true);
|
||||
},
|
||||
...(search ? { request: { search_term: search } } : {}),
|
||||
...(localSearch ? { request: { search_term: localSearch } } : {}),
|
||||
requestList: true,
|
||||
// ...(search ? { resultsKey: "weights" } : {}),
|
||||
urlParam: owner || username,
|
||||
...(localSearch ? { resultsKey: "weights" } : {}),
|
||||
urlParam: owner || username || "",
|
||||
urlUpdate: false,
|
||||
});
|
||||
|
||||
useDebounce({
|
||||
blocked: !searchUpdated,
|
||||
onTimeout: () => {
|
||||
searchUpdatedSet(false);
|
||||
entities.reFetch();
|
||||
}
|
||||
})
|
||||
|
||||
const localSearchChange = ({ target }: { target: any }) => {
|
||||
searchUpdatedSet(true);
|
||||
// entities.reFetch();
|
||||
onSearchChange({ target });
|
||||
localSearchSet(target.value);
|
||||
};
|
||||
|
||||
const handlePageClick = (selectedItem: { selected: number }) => {
|
||||
entities.pageChange(selectedItem.selected);
|
||||
};
|
||||
@@ -108,7 +129,12 @@ export default function MediaBrowser({
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalHeader {...{ handleClose, title }}>
|
||||
<ModalHeader {...{
|
||||
onSearchChange: localSearchChange,
|
||||
handleClose,
|
||||
search: localSearch,
|
||||
title
|
||||
}}>
|
||||
<TempSelect
|
||||
{...{
|
||||
icon: faArrowDownWideShort,
|
||||
@@ -144,7 +170,7 @@ export default function MediaBrowser({
|
||||
<div {...{ className: "fy-media-browser-list" }}>
|
||||
<MediaList
|
||||
{...{
|
||||
entityType: 1,
|
||||
entityType: 2,
|
||||
list: entities.list,
|
||||
success: entities.status === 3,
|
||||
onClick,
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
import React from "react";
|
||||
import { TempInput as Input } from "components/common";
|
||||
import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
|
||||
import { faXmark } from "@fortawesome/pro-solid-svg-icons";
|
||||
|
||||
interface Props {
|
||||
children?: any;
|
||||
handleClose?: any;
|
||||
onSearchChange?: (e: any) => void;
|
||||
search?: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export default function ModalHeader({ children, handleClose, title }: Props) {
|
||||
export default function ModalHeader({ children, handleClose, onSearchChange = () => {}, search, title }: Props) {
|
||||
return (
|
||||
<header {...{ className: "fy-media-browser-header" }}>
|
||||
<div {...{ className: "fy-media-browser-tools" }}>
|
||||
{title && <h3 className="fw-semibold">{title}</h3>}
|
||||
{handleClose && (
|
||||
{ search !== undefined ? <Input autoFocus {...{ onChange: onSearchChange, value: search }}/> :
|
||||
title && <h3 className="fw-semibold">{ title }</h3> }
|
||||
{ handleClose && (
|
||||
<Icon
|
||||
{...{
|
||||
className: "icon-close-button",
|
||||
|
||||
@@ -2,12 +2,14 @@ import useBatchContent from './useBatchContent';
|
||||
import useBookmarks from './useBookmarks';
|
||||
import useChanger from './useChanger';
|
||||
import useCoverImgUpload from './useCoverImgUpload';
|
||||
import useDebounce from './useDebounce';
|
||||
import useFile from './useFile';
|
||||
import useHover from './useHover';
|
||||
import useId from './useId';
|
||||
import useIdempotency from './useIdempotency';
|
||||
import useInferenceJobs from './useInferenceJobs';
|
||||
import useInterval from './useInterval';
|
||||
import useJobStatus from './useJobStatus';
|
||||
import useLazyLists from './useLazyLists';
|
||||
import useListContent from './useListContent';
|
||||
import useLocalize from './useLocalize';
|
||||
@@ -28,12 +30,14 @@ export {
|
||||
useBookmarks,
|
||||
useChanger,
|
||||
useCoverImgUpload,
|
||||
useDebounce,
|
||||
useFile,
|
||||
useHover,
|
||||
useId,
|
||||
useIdempotency,
|
||||
useInferenceJobs,
|
||||
useInterval,
|
||||
useJobStatus,
|
||||
useLazyLists,
|
||||
useListContent,
|
||||
useLocalize,
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "./useDebounce";
|
||||
@@ -0,0 +1,21 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
interface Props {
|
||||
delay?: number,
|
||||
blocked?: boolean,
|
||||
onTimeout?: () => any
|
||||
}
|
||||
|
||||
export default function useDebounce({ blocked, delay = 500, onTimeout = () => {} }: Props) {
|
||||
useEffect(() => {
|
||||
const delayed = setTimeout(() => {
|
||||
if (!blocked) {
|
||||
onTimeout();
|
||||
}
|
||||
}, delay)
|
||||
|
||||
return () => clearTimeout(delayed)
|
||||
}, [blocked,delay,onTimeout]);
|
||||
|
||||
return null;
|
||||
};
|
||||
@@ -16,8 +16,8 @@ export default function useInferenceJobs(jobType: JobListTypes = 0, debug = fals
|
||||
|
||||
return {
|
||||
// enqueue,
|
||||
enqueue: (jobToken: string) => {
|
||||
openJobListModal();
|
||||
enqueue: (jobToken: string, noModalPls = false) => {
|
||||
if (!noModalPls) { openJobListModal(); }
|
||||
enqueue(jobToken,jobType);
|
||||
},
|
||||
inferenceJobs: jobType === JobListAll.All ? inferenceJobs : (byCategory?.get(jobType - 1) || []),
|
||||
|
||||
@@ -19,20 +19,19 @@ export default function useInterval(props: any) {
|
||||
const { end = 3, index, locked = false, onTick = (e: IntervalEvent) => {}, start = 0 } = config.current;
|
||||
config.current.index = index < end ? index + 1 : start;
|
||||
|
||||
if (!locked) onTick(config.current);
|
||||
}, props.interval);
|
||||
if (!locked) {
|
||||
onTick(config.current);
|
||||
}
|
||||
}, props.interval || 500);
|
||||
|
||||
tickerSet(Number(newTicker) || 9999);
|
||||
// loadedSet(true);
|
||||
}
|
||||
if (props.locked !== config.current.locked) {
|
||||
if (ticker && props.locked !== config.current.locked) {
|
||||
config.current.locked = props.locked;
|
||||
tickerSet(null);
|
||||
return () => clearInterval(ticker);
|
||||
}
|
||||
|
||||
// if (kill && ticker) { // not needed for now
|
||||
// return () => clearInterval(ticker);
|
||||
// }
|
||||
|
||||
},[props,ticker]);
|
||||
|
||||
return config.current;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "./useJobStatus";
|
||||
@@ -0,0 +1,38 @@
|
||||
import { useState } from 'react';
|
||||
import { useInterval } from "hooks";
|
||||
import { JobState, jobStateFromString, jobStateCanChange } from "@storyteller/components/src/jobs/JobStates";
|
||||
import { GetJobStatus, GetJobStatusResponse, JobStatus }
|
||||
from "@storyteller/components/src/api/model_inference/GetJobStatus";
|
||||
|
||||
interface Props {
|
||||
jobToken?: string;
|
||||
}
|
||||
|
||||
export default function useJobStatus({ jobToken }: Props) {
|
||||
const [job,jobSet] = useState<JobStatus>();
|
||||
const [stop,stopSet] = useState<boolean | undefined>();
|
||||
|
||||
useInterval({
|
||||
// locked: true,
|
||||
locked: stop || !jobToken,
|
||||
interval: 1500,
|
||||
onTick: (a: any) => {
|
||||
if (jobToken) {
|
||||
GetJobStatus(jobToken,{})
|
||||
.then((res: GetJobStatusResponse) => {
|
||||
let continuePolling = jobStateCanChange(jobStateFromString(res.state.status.status));
|
||||
|
||||
console.log("😎",res.state);
|
||||
jobSet(res.state);
|
||||
if (!continuePolling) stopSet(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
...job,
|
||||
maybe_result: job?.maybe_result || null,
|
||||
isSuccessful: jobStateFromString(job?.status.status || "") === JobState.COMPLETE_SUCCESS
|
||||
};
|
||||
};
|
||||
@@ -81,7 +81,7 @@ export default function useListContent({
|
||||
...(sort ? { sort_ascending: true } : {}),
|
||||
};
|
||||
|
||||
if (urlParam) {
|
||||
if (urlParam !== undefined) {
|
||||
if (status === FetchStatus.ready) {
|
||||
let search = new URLSearchParams(queries).toString();
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ import TextToImagePage from "./pages/text_to_image/TextToImagePage";
|
||||
import DomainConfigProvider from "context/DomainConfigContext";
|
||||
import DevUpload from "./pages/dev_upload/DevUpload";
|
||||
import DevMediaInput from "./pages/dev_upload/DevMediaInput";
|
||||
import DevTTS from "./pages/dev_tts/DevTTS";
|
||||
import { StudioIntroPage } from "./pages/storyteller_studio_intro/StudioIntroPage";
|
||||
import StudioVSTPage from "./pages/storyteller_studio_intro/StudioVST/StudioVSTPage";
|
||||
import { StudioIntroResultPage } from "./pages/storyteller_studio_intro/StudioIntroResultPage";
|
||||
@@ -808,11 +809,10 @@ class PageContainer extends React.Component<
|
||||
<DevMediaInput />
|
||||
</Route>
|
||||
|
||||
{
|
||||
// <Route path="/dev-tts">
|
||||
// <DevTTS />
|
||||
// </Route>
|
||||
}
|
||||
<Route path="/dev-tts">
|
||||
<DevTTS />
|
||||
</Route>
|
||||
|
||||
{/* Route for initial voice creation */}
|
||||
<Route exact path="/voice-designer/create">
|
||||
<VoiceDesignerFormPage
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
@import "scss/colours.scss";
|
||||
@import "scss/site-refresh.scss";
|
||||
|
||||
.fy-weight-picker {
|
||||
|
||||
@include panel;
|
||||
border-radius: .5rem;
|
||||
background-color: rgba($secondary, .6);
|
||||
|
||||
&.fy-weight-picker-full {
|
||||
.fy-input input { border-radius: .5rem .5rem 0 0 }
|
||||
}
|
||||
|
||||
.fy-weight-picker-preview {
|
||||
border-top: 1px solid rgba(#fff,.15);
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.fy-card-badge {
|
||||
display: inline-flex;
|
||||
margin-left: .5rem;
|
||||
}
|
||||
|
||||
.fy-input { margin-bottom: 0 }
|
||||
|
||||
.fy-weight-picker-reselect {
|
||||
background-color: $secondary-light;
|
||||
border-radius: .5rem;
|
||||
padding: .5rem;
|
||||
margin: 0 0 auto auto;
|
||||
}
|
||||
}
|
||||
|
||||
.fy-card-badge {
|
||||
display: flex;
|
||||
height: min-content;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
import React, { useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import PageHeader from 'components/layout/PageHeader';
|
||||
import { MediaBrowser } from "components/modals";
|
||||
import { CardBadge } from "components/entities";
|
||||
import { Button, Container, Label, Panel, TempTextArea as TextArea, TempInput as Input, WeightCoverImage } from "components/common";
|
||||
import { useDebounce, useModal } from "hooks";
|
||||
import { BucketConfig } from "@storyteller/components/src/api/BucketConfig";
|
||||
import { Weight } from "@storyteller/components/src/api/weights/GetWeight";
|
||||
import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
|
||||
import { faRotateLeft, faSearch } from "@fortawesome/pro-solid-svg-icons";
|
||||
import "./DevTTS.scss";
|
||||
|
||||
interface Props {
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export default function DevTTS({ value }: Props) {
|
||||
const { modalState, open } = useModal();
|
||||
const [search,searchSet] = useState("");
|
||||
const [updated,updatedSet] = useState(false);
|
||||
const [selectedVoice,selectedVoiceSet] = useState<Weight | undefined>();
|
||||
const [text,textSet] = useState("");
|
||||
const bucketConfig = new BucketConfig();
|
||||
const preview = bucketConfig.getCdnUrl(selectedVoice?.cover_image?.maybe_cover_image_public_bucket_path || "");
|
||||
|
||||
const textChange = ({ target }: { target: any }) => {
|
||||
textSet(target.value);
|
||||
};
|
||||
|
||||
const searchChange = (setUpdate = true) => ({ target }: { target: any }) => {
|
||||
// console.log("🩵",target.value);
|
||||
if (setUpdate) updatedSet(true);
|
||||
// console.log("aaaa",);
|
||||
searchSet(target.value);
|
||||
};
|
||||
|
||||
useDebounce({
|
||||
blocked: !(updated && !modalState && search),
|
||||
onTimeout: () => {
|
||||
updatedSet(false);
|
||||
open({
|
||||
component: MediaBrowser,
|
||||
props: {
|
||||
onSelect: (weight: any) => selectedVoiceSet(weight),
|
||||
inputMode: 3,
|
||||
onSearchChange: searchChange(false),
|
||||
search
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return <Container>
|
||||
<PageHeader {...{ title: "TTS" }}/>
|
||||
<Panel padding {...{ className: ""}}>
|
||||
<Label {...{ label: "Select a voice" }}/>
|
||||
<div {...{ className: `fy-weight-picker mb-3 fy-weight-picker-${ selectedVoice ? "full" : "empty" }` }}>
|
||||
<Input autoFocus {...{ icon: faSearch, placeholder: "Search 9999 voices...", onChange: searchChange(), value: search }}/>
|
||||
{
|
||||
selectedVoice && <div {...{ className: "fy-weight-picker-preview p-3" }}>
|
||||
<WeightCoverImage {...{ src: preview, height: 60, width: 60 }}/>
|
||||
<div {...{ className: "fy-weight-picker-preview-details" }}>
|
||||
<h6>
|
||||
{ selectedVoice.title }
|
||||
<CardBadge {...{
|
||||
className: `fy-entity-type-${ selectedVoice.weight_type || "" }`,
|
||||
label: selectedVoice.weight_type || ""
|
||||
}}/>
|
||||
</h6>
|
||||
<span>
|
||||
by
|
||||
<Link {...{ className: "fw-medium", to: `/profile/${ selectedVoice.creator?.username || "" }`}}>
|
||||
{
|
||||
" " + selectedVoice.creator?.display_name || ""
|
||||
}
|
||||
</Link>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<Icon {...{ className: "fy-weight-picker-reselect", icon: faRotateLeft }}/>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
{ selectedVoice && <TextArea autoFocus {...{ label: "Enter text", onChange: textChange, value: text }}/> }
|
||||
{
|
||||
text && <Button autoFocus {...{ label: "Speak" }}/>
|
||||
}
|
||||
</Panel>
|
||||
</Container>;
|
||||
};
|
||||
+4
-2
@@ -248,7 +248,9 @@ export default function LandingDemo({
|
||||
|
||||
<div className="d-flex flex-column mt-3">
|
||||
<div className="d-flex justify-content-center pb-2">
|
||||
<label className="sub-title flex-grow-1 pb-0">Your Text</label>
|
||||
<label className="sub-title flex-grow-1 pb-0">
|
||||
What would you like to say?
|
||||
</label>
|
||||
<Button
|
||||
icon={faShuffle}
|
||||
label="Randomize Text"
|
||||
@@ -272,7 +274,7 @@ export default function LandingDemo({
|
||||
<div className="d-flex gap-3 align-items-center mt-4">
|
||||
<Button
|
||||
icon={isPlaying ? faPause : faPlay}
|
||||
square={true}
|
||||
label="Speak"
|
||||
onClick={handleEnqueueTts}
|
||||
isLoading={isAudioLoading}
|
||||
disabled={textBuffer.length === 0}
|
||||
|
||||
@@ -40,7 +40,7 @@ import { GetMediaBatchImages } from "@storyteller/components/src/api/media_files
|
||||
import { mediaTypeLabels } from "utils/mediaTypeLabels";
|
||||
|
||||
// Storyteller Engine parameters
|
||||
// These are documented here:
|
||||
// These are documented here:
|
||||
// https://www.notion.so/storytellerai/Studio-Iframe-Query-Params-a748a9929ec3404780c3884e7fb89bdb
|
||||
const SKYBOX = "333348"; // Looks good (lighter)
|
||||
//const SKYBOX = "242433"; // Looks good
|
||||
@@ -111,6 +111,58 @@ export default function MediaPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const promptSection = (
|
||||
<>
|
||||
{prompt?.maybe_positive_prompt && (
|
||||
<Panel padding={true} className="mt-3">
|
||||
<div className="d-flex gap-3 align-items-center mb-2">
|
||||
<h6 className="fw-semibold mb-0 flex-grow-1">Prompt</h6>
|
||||
<Button
|
||||
icon={faCopy}
|
||||
onClick={() =>
|
||||
copyToClipboard(
|
||||
prompt.maybe_positive_prompt || "",
|
||||
setCopyPositiveButtonText
|
||||
)
|
||||
}
|
||||
label={copyPositiveButtonText}
|
||||
variant="link"
|
||||
className="fs-7"
|
||||
/>
|
||||
</div>
|
||||
<div className="panel-inner p-2 rounded">
|
||||
<p className="fs-7">{prompt.maybe_positive_prompt}</p>
|
||||
</div>
|
||||
|
||||
{prompt?.maybe_negative_prompt && (
|
||||
<>
|
||||
<div className="d-flex gap-3 align-items-center mb-2 mt-3">
|
||||
<h6 className="fw-semibold mb-0 flex-grow-1">
|
||||
Negative Prompt
|
||||
</h6>
|
||||
<Button
|
||||
icon={faCopy}
|
||||
onClick={() =>
|
||||
copyToClipboard(
|
||||
prompt.maybe_negative_prompt || "",
|
||||
setCopyNegativeButtonText
|
||||
)
|
||||
}
|
||||
label={copyNegativeButtonText}
|
||||
variant="link"
|
||||
className="fs-7"
|
||||
/>
|
||||
</div>
|
||||
<div className="panel-inner p-2 rounded">
|
||||
<p className="fs-7">{prompt.maybe_negative_prompt}</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Panel>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
function renderMediaComponent(mediaFile: MediaFile) {
|
||||
switch (mediaFile.media_type) {
|
||||
case MediaFileType.Audio:
|
||||
@@ -141,6 +193,7 @@ export default function MediaPage() {
|
||||
<MediaVideoComponent mediaFile={mediaFile} />
|
||||
</div>
|
||||
</div>
|
||||
{promptSection}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -156,53 +209,7 @@ export default function MediaPage() {
|
||||
key={images.length}
|
||||
images={mediaFile.maybe_batch_token ? images : sdMediaImage}
|
||||
/>
|
||||
{prompt?.maybe_positive_prompt && (
|
||||
<Panel padding={true} className="mt-3">
|
||||
<div className="d-flex gap-3 align-items-center mb-2">
|
||||
<h6 className="fw-semibold mb-0 flex-grow-1">Prompt</h6>
|
||||
<Button
|
||||
icon={faCopy}
|
||||
onClick={() =>
|
||||
copyToClipboard(
|
||||
prompt.maybe_positive_prompt || "",
|
||||
setCopyPositiveButtonText
|
||||
)
|
||||
}
|
||||
label={copyPositiveButtonText}
|
||||
variant="link"
|
||||
className="fs-7"
|
||||
/>
|
||||
</div>
|
||||
<div className="panel-inner p-2 rounded">
|
||||
<p className="fs-7">{prompt.maybe_positive_prompt}</p>
|
||||
</div>
|
||||
|
||||
{prompt?.maybe_negative_prompt && (
|
||||
<>
|
||||
<div className="d-flex gap-3 align-items-center mb-2 mt-3">
|
||||
<h6 className="fw-semibold mb-0 flex-grow-1">
|
||||
Negative Prompt
|
||||
</h6>
|
||||
<Button
|
||||
icon={faCopy}
|
||||
onClick={() =>
|
||||
copyToClipboard(
|
||||
prompt.maybe_negative_prompt || "",
|
||||
setCopyNegativeButtonText
|
||||
)
|
||||
}
|
||||
label={copyNegativeButtonText}
|
||||
variant="link"
|
||||
className="fs-7"
|
||||
/>
|
||||
</div>
|
||||
<div className="panel-inner p-2 rounded">
|
||||
<p className="fs-7">{prompt.maybe_negative_prompt}</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Panel>
|
||||
)}
|
||||
{promptSection}
|
||||
</>
|
||||
);
|
||||
case MediaFileType.BVH:
|
||||
|
||||
@@ -48,7 +48,7 @@ function StudioIntroPage(props: Props) {
|
||||
media_file_token: mediaToken || "",
|
||||
}).then((res: any) => {
|
||||
if (res && res.success) {
|
||||
inferenceJobs.enqueue(res.inference_job_token);
|
||||
inferenceJobs.enqueue(res.inference_job_token,true); // noModalPls = true
|
||||
history.push(`/studio-intro/style/${res.inference_job_token}`);
|
||||
}
|
||||
});
|
||||
|
||||
+8
-3
@@ -6,7 +6,7 @@ import { usePrefixedDocumentTitle } from "common/UsePrefixedDocumentTitle";
|
||||
import { useHistory, useParams } from "react-router-dom";
|
||||
import "./StudioIntro.scss";
|
||||
import LoadingSpinner from "components/common/LoadingSpinner";
|
||||
import { useMedia } from "hooks";
|
||||
import { useMedia, useJobStatus } from "hooks";
|
||||
import { BucketConfig } from "@storyteller/components/src/api/BucketConfig";
|
||||
import { MediaFileType } from "@storyteller/components/src/api/media_files";
|
||||
|
||||
@@ -23,13 +23,18 @@ function StudioIntroResultPage(props: Props) {
|
||||
// const [mediaToken, setMediaToken] = useState(
|
||||
// "m_f5kp3hm74qeq16eq7536jb73jkbvkh"
|
||||
// ); // Set the media token after polling success
|
||||
const mediaToken = "m_f5kp3hm74qeq16eq7536jb73jkbvkh"
|
||||
// const [jobExists, setJobExists] = useState<boolean | null>(null);
|
||||
|
||||
const job = useJobStatus({ jobToken });
|
||||
|
||||
console.log("🩵",job);
|
||||
|
||||
const [mediaFile, setMediaFile] = useState<MediaFileType>();
|
||||
|
||||
const mediaToken = job?.maybe_result?.entity_token || "";
|
||||
|
||||
useMedia({
|
||||
mediaToken: mediaToken,
|
||||
mediaToken,
|
||||
onSuccess: (res: any) => {
|
||||
setMediaFile(res);
|
||||
},
|
||||
|
||||
+24
-10
@@ -10,6 +10,7 @@ import {
|
||||
import VideoQuickTrim, {
|
||||
QuickTrimData,
|
||||
} from "components/common/VideoQuickTrim";
|
||||
import { useJobStatus } from "hooks";
|
||||
import EnqueueVideoStyleTransfer from "@storyteller/components/src/api/video_styleTransfer";
|
||||
import { initialValues } from "./defaultValues";
|
||||
import { mapRequest, VSTType } from "./helpers";
|
||||
@@ -20,24 +21,37 @@ export default function PageVSTApp() {
|
||||
const { jobToken } = useParams<{ jobToken: string }>();
|
||||
const videoRef = useRef<HTMLVideoElement>(null);
|
||||
const history = useHistory();
|
||||
// const [mediaToken, setMediaToken] = useState(
|
||||
// "m_wnnz9jey96dwhss9qk1891v9gmvnj8" // Currently hardcoded video media token value. Let a job polling function set the value when job returns media on success.
|
||||
// );
|
||||
const mediaToken = "m_wnnz9jey96dwhss9qk1891v9gmvnj8";
|
||||
// const [jobExists, setJobExists] = useState<boolean | null>(null);
|
||||
|
||||
const job = useJobStatus({ jobToken });
|
||||
|
||||
const [vstValues, setVstValues] = useState<VSTType>({
|
||||
...initialValues,
|
||||
fileToken: mediaToken,
|
||||
// fileToken: job?.maybe_result?.entity_token || "",
|
||||
});
|
||||
|
||||
console.log(job);
|
||||
console.log(job?.maybe_result);
|
||||
console.log(job?.maybe_result?.entity_token);
|
||||
|
||||
const handleOnChange = (val: {
|
||||
[key: string]: number | string | boolean | undefined;
|
||||
}) => {
|
||||
setVstValues(curr => ({ ...curr, ...val }));
|
||||
console.log("VST Values", vstValues);
|
||||
};
|
||||
|
||||
const handleGenerate = () => {
|
||||
const request = mapRequest(vstValues);
|
||||
let updatedVSTValues = Object.assign({}, vstValues);
|
||||
updatedVSTValues.fileToken = job?.maybe_result?.entity_token || "";
|
||||
updatedVSTValues.trimStart = 0;
|
||||
updatedVSTValues.trimEnd = 3;
|
||||
|
||||
const request = mapRequest(updatedVSTValues);
|
||||
|
||||
// request.maybe_input_file = job?.maybe_result?.entity_token || "";
|
||||
// request.maybe_trim_start_seconds = 0;
|
||||
// request.maybe_trim_end_seconds = 3;
|
||||
|
||||
EnqueueVideoStyleTransfer(request).then(res => {
|
||||
if (res.success && res.inference_job_token) {
|
||||
console.log("Job enqueued successfully", res.inference_job_token);
|
||||
@@ -97,9 +111,9 @@ export default function PageVSTApp() {
|
||||
<Panel padding={true}>
|
||||
<div className="row g-5">
|
||||
<div className="col-12 col-md-6">
|
||||
{vstValues.fileToken ? (
|
||||
{job.isSuccessful && job.maybe_result ? (
|
||||
<VideoQuickTrim
|
||||
mediaToken={vstValues.fileToken}
|
||||
mediaToken={job.maybe_result.entity_token}
|
||||
onSelect={(val: QuickTrimData) =>
|
||||
handleOnChange({
|
||||
trimStart: val.trimStartSeconds,
|
||||
@@ -151,7 +165,7 @@ export default function PageVSTApp() {
|
||||
label="Generate Your Movie"
|
||||
onClick={handleGenerate}
|
||||
variant="primary"
|
||||
disabled={!vstValues.fileToken}
|
||||
disabled={!job.isSuccessful}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -11,10 +11,10 @@ const initialValues = {
|
||||
height: 1024,
|
||||
maxDuration: 0,
|
||||
trimStart: 0,
|
||||
trimEnd: 0,
|
||||
trimEnd: 3,
|
||||
|
||||
//Presents
|
||||
workflowConfig: "weight_99tz2nzbp5x9v55gqn5ekj1sd",
|
||||
workflowConfig: "weight_0a04e66y14t4e2bwxjfyg1mb2", //weight_99tz2nzbp5x9v55gqn5ekj1sd
|
||||
sdModelToken: "weight_yqexh77ntqyawzgh9fzash798",
|
||||
loraModelToken: "",
|
||||
loraModelStrength: 0,
|
||||
|
||||
+32
-33
@@ -11,7 +11,7 @@ export type VSTType = {
|
||||
maxDuration: number;
|
||||
trimStart: number;
|
||||
trimEnd: number;
|
||||
|
||||
|
||||
// Presets
|
||||
workflowConfig: string;
|
||||
sdModelToken: string;
|
||||
@@ -34,59 +34,58 @@ export type VSTType = {
|
||||
cnPipeFace: number;
|
||||
cnSparseScribble: number;
|
||||
cnSoftEdge: number;
|
||||
cnRegularSteps: number
|
||||
}
|
||||
cnRegularSteps: number;
|
||||
};
|
||||
|
||||
export function isInputValid(keyValues: {[key:string]:number|string|boolean|undefined}){
|
||||
export function isInputValid(keyValues: {
|
||||
[key: string]: number | string | boolean | undefined;
|
||||
}) {
|
||||
return (
|
||||
keyValues.sdModelToken
|
||||
&& keyValues.sdModelToken !== ""
|
||||
&& keyValues.posPrompt
|
||||
&& keyValues.posPrompt !== ""
|
||||
keyValues.sdModelToken &&
|
||||
keyValues.sdModelToken !== "" &&
|
||||
keyValues.posPrompt &&
|
||||
keyValues.posPrompt !== ""
|
||||
);
|
||||
}
|
||||
|
||||
export function mapRequest(vstValues: VSTType){
|
||||
export function mapRequest(vstValues: VSTType) {
|
||||
//TODO: improve the typing of this
|
||||
return{
|
||||
"uuid_idempotency_token": uuidv4(),
|
||||
"maybe_sd_model": vstValues.sdModelToken,
|
||||
"maybe_workflow_config":vstValues.workflowConfig,
|
||||
"maybe_input_file": vstValues.fileToken,
|
||||
"maybe_trim_start_seconds": vstValues.trimStart,
|
||||
"maybe_trim_end_seconds": vstValues.trimEnd,
|
||||
"maybe_output_path": vstValues.outputPath,
|
||||
"creator_set_visibility": vstValues.visibility,
|
||||
"maybe_json_modifications": {
|
||||
return {
|
||||
uuid_idempotency_token: uuidv4(),
|
||||
maybe_sd_model: vstValues.sdModelToken,
|
||||
maybe_workflow_config: vstValues.workflowConfig,
|
||||
maybe_input_file: vstValues.fileToken,
|
||||
maybe_trim_start_seconds: 0, //vstValues.trimStart
|
||||
maybe_trim_end_seconds: 3, //vstValues.trimEnd
|
||||
maybe_output_path: vstValues.outputPath,
|
||||
creator_set_visibility: vstValues.visibility,
|
||||
maybe_json_modifications: {
|
||||
"$.154.inputs.Value": vstValues.inputFps,
|
||||
"$.510.inputs.Text":
|
||||
hiddenValues.posPrompt + vstValues.posPrompt,
|
||||
"$.8.inputs.text":
|
||||
hiddenValues.negPrompt+ vstValues.negPrompt,
|
||||
"$.510.inputs.Text": hiddenValues.posPrompt + vstValues.posPrompt,
|
||||
"$.8.inputs.text": hiddenValues.negPrompt + vstValues.negPrompt,
|
||||
|
||||
"$.401.inputs.Value": 0.7, //Denoise First Pass
|
||||
"$.140.inputs.Value": 1, // Every nth frame
|
||||
"$.536.inputs.boolean_number": 1, // use LCM
|
||||
"$.140.inputs.Value": 1, // Every nth frame
|
||||
"$.536.inputs.boolean_number": 1, // use LCM
|
||||
"$.1075.inputs.Value": 1280,
|
||||
"$.1076.inputs.Value": 720,
|
||||
"$.1079.inputs.Value": 1280,
|
||||
"$.1080.inputs.Value": 720,
|
||||
|
||||
"$.403.inputs.Value": vstValues.cnSparseScribble,
|
||||
"$.771.inputs.Value": vstValues.cnOpenPose,
|
||||
"$.772.inputs.Value": vstValues.cnDepth,
|
||||
"$.403.inputs.Value": vstValues.cnSparseScribble,
|
||||
"$.771.inputs.Value": vstValues.cnOpenPose,
|
||||
"$.772.inputs.Value": vstValues.cnDepth,
|
||||
"$.796.inputs.Value": vstValues.cnLineArtRealistic,
|
||||
"$.797.inputs.Value": vstValues.cnLineArtAnime,
|
||||
"$.797.inputs.Value": vstValues.cnLineArtAnime,
|
||||
"$.1398.inputs.Value": vstValues.cnSoftEdge,
|
||||
"$.1531.inputs.Value": vstValues.cnRegularSteps,
|
||||
|
||||
//"$.800.inputs.Value": 0, // vstValues.cnCanny,
|
||||
//"$.1636.inputs.Value": 0, //vstValues.cnLipsStrength,
|
||||
|
||||
|
||||
// "$.208.inputs.lora_01": vstValues.loraModelToken,
|
||||
// "$.208.inputs.strength_01": vstValues.loraModelStrength
|
||||
// "$.1449.inputs.filename_prefix": "vid2vid/SparseUpscaleInterp",
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
+4
-2
@@ -1,4 +1,5 @@
|
||||
import { defaultPreset as defaultCN } from "./cnPresets";
|
||||
import styleModels from "./styleModel";
|
||||
export {initialValues, hiddenValues};
|
||||
const initialValues = {
|
||||
//files Settings
|
||||
@@ -13,8 +14,9 @@ const initialValues = {
|
||||
trimEnd: 0,
|
||||
|
||||
//Presents
|
||||
workflowConfig: "weight_99tz2nzbp5x9v55gqn5ekj1sd",
|
||||
sdModelToken: "weight_yqexh77ntqyawzgh9fzash798",
|
||||
workflowConfig: "weight_0a04e66y14t4e2bwxjfyg1mb2",
|
||||
sdModelToken: styleModels[0].weight_token,
|
||||
sdModelTitle: styleModels[0].title,
|
||||
loraModelToken: "",
|
||||
loraModelStrength: 0,
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ export type VSTType = {
|
||||
// Presets
|
||||
workflowConfig: string;
|
||||
sdModelToken: string;
|
||||
sdModelTitle: string;
|
||||
// loraModelToken: string;
|
||||
// loraModelStrength: number;
|
||||
|
||||
|
||||
+93
-92
@@ -1,33 +1,27 @@
|
||||
import React, {
|
||||
// useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import React, { useState } from "react";
|
||||
import { NavLink } from "react-router-dom";
|
||||
import { useParams, useHistory } from "react-router-dom";
|
||||
|
||||
import {
|
||||
Button,
|
||||
Panel,
|
||||
// NumberSliderV2,
|
||||
TextArea,
|
||||
} from "components/common";
|
||||
import VideoQuickTrim, {QuickTrimData} from 'components/common/VideoQuickTrim';
|
||||
|
||||
import { Button, Panel, TextArea, WeightsCards } from "components/common";
|
||||
import VideoQuickTrim, {
|
||||
QuickTrimData,
|
||||
} from "components/common/VideoQuickTrim";
|
||||
import { SelectModalV2 } from "components/common/SelectModal";
|
||||
import EnqueueVideoStyleTransfer from "@storyteller/components/src/api/video_styleTransfer";
|
||||
|
||||
|
||||
import { Action, State } from "../../reducer";
|
||||
import { initialValues } from "./defaultValues";
|
||||
import {
|
||||
mapRequest,
|
||||
VSTType,
|
||||
} from "./helpers";
|
||||
import { mapRequest, VSTType } from "./helpers";
|
||||
|
||||
import styleModels from "./styleModel";
|
||||
import SectionAdvanceOptions from "./sectionAdvanceOptions";
|
||||
|
||||
|
||||
export default function PageVSTApp({
|
||||
debug, t, pageState, dispatchPageState, parentPath
|
||||
debug,
|
||||
t,
|
||||
pageState,
|
||||
dispatchPageState,
|
||||
parentPath,
|
||||
}: {
|
||||
debug?: boolean;
|
||||
t: Function;
|
||||
@@ -42,93 +36,103 @@ export default function PageVSTApp({
|
||||
fileToken: pageState.mediaFileToken || mediaToken,
|
||||
});
|
||||
|
||||
const handleOnChange = (val:{[key: string]: number|string|boolean|undefined}) => {
|
||||
setVstValues((curr)=>({...curr, ...val}));
|
||||
}
|
||||
|
||||
const handleOnChange = (val: {
|
||||
[key: string]: number | string | boolean | undefined;
|
||||
}) => {
|
||||
setVstValues(curr => ({ ...curr, ...val }));
|
||||
};
|
||||
|
||||
const history = useHistory();
|
||||
const handleGenerate = ()=>{
|
||||
if(debug) console.log(vstValues)
|
||||
const handleGenerate = () => {
|
||||
if (debug) console.log(vstValues);
|
||||
|
||||
const request = mapRequest(vstValues);
|
||||
if (debug) console.log(request);
|
||||
EnqueueVideoStyleTransfer(request).then(res => {
|
||||
if (res.success && res.inference_job_token) {
|
||||
dispatchPageState({
|
||||
type: 'enqueueJobSuccess',
|
||||
type: "enqueueJobSuccess",
|
||||
payload: {
|
||||
inferenceJobToken: res.inference_job_token
|
||||
}
|
||||
})
|
||||
}else{
|
||||
inferenceJobToken: res.inference_job_token,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
dispatchPageState({type: 'enqueueJob'})
|
||||
});
|
||||
dispatchPageState({ type: "enqueueJob" });
|
||||
history.push(`${parentPath}/jobs`);
|
||||
}
|
||||
};
|
||||
|
||||
return(
|
||||
<Panel className="mb-4 p-4">
|
||||
<div className="row g-3 mb-4">
|
||||
<div className="col-12 col-md-6">
|
||||
<VideoQuickTrim
|
||||
// label={t("video.label.original")}
|
||||
mediaToken={vstValues.fileToken}
|
||||
// ref={videoRef}
|
||||
onSelect={(val:QuickTrimData)=>handleOnChange({
|
||||
trimStart: val.trimStartSeconds,
|
||||
trimEnd: val.trimEndSeconds
|
||||
})}
|
||||
onResponse={(res)=>{
|
||||
dispatchPageState({
|
||||
type: 'loadFileSuccess',
|
||||
payload: {
|
||||
mediaFile: res,
|
||||
mediaFileToken: pageState.mediaFileToken || mediaToken
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
return (
|
||||
<Panel padding={true}>
|
||||
<div className="row g-5 mb-4">
|
||||
<div className="col-12 col-md-6">
|
||||
<TextArea
|
||||
{...{
|
||||
label: t("input.label.prompt"),
|
||||
placeholder: t("input.placeholder.prompt"),
|
||||
onChange: (e:React.ChangeEvent<HTMLTextAreaElement>)=>handleOnChange({posPrompt: e.target.value}),
|
||||
value: vstValues.posPrompt,
|
||||
required: false,
|
||||
}}
|
||||
<VideoQuickTrim
|
||||
mediaToken={vstValues.fileToken}
|
||||
onSelect={(val: QuickTrimData) =>
|
||||
handleOnChange({
|
||||
trimStart: val.trimStartSeconds,
|
||||
trimEnd: val.trimEndSeconds,
|
||||
})
|
||||
}
|
||||
onResponse={res => {
|
||||
dispatchPageState({
|
||||
type: "loadFileSuccess",
|
||||
payload: {
|
||||
mediaFile: res,
|
||||
mediaFileToken: pageState.mediaFileToken || mediaToken,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
{/* </div>
|
||||
<div className="col-12 col-md-6"> */}
|
||||
</div>
|
||||
<div className="col-12 col-md-6 d-flex flex-column gap-3">
|
||||
<TextArea
|
||||
{...{
|
||||
label: t("input.label.negPrompt"),
|
||||
placeholder: t("input.placeholder.negPrompt"),
|
||||
onChange: (e:React.ChangeEvent<HTMLTextAreaElement>)=>handleOnChange({negPrompt: e.target.value}),
|
||||
value: vstValues.negPrompt,
|
||||
required: false,
|
||||
}}
|
||||
{...{
|
||||
label: t("input.label.prompt"),
|
||||
placeholder: t("input.placeholder.prompt"),
|
||||
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
||||
handleOnChange({ posPrompt: e.target.value }),
|
||||
value: vstValues.posPrompt,
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
<br/>
|
||||
<SectionAdvanceOptions
|
||||
<TextArea
|
||||
{...{
|
||||
label: t("input.label.negPrompt"),
|
||||
placeholder: t("input.placeholder.negPrompt"),
|
||||
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
||||
handleOnChange({ negPrompt: e.target.value }),
|
||||
value: vstValues.negPrompt,
|
||||
required: false,
|
||||
}}
|
||||
/>
|
||||
|
||||
<SelectModalV2
|
||||
modalTitle="Select Styles"
|
||||
label="Select Style"
|
||||
value={vstValues.sdModelTitle}
|
||||
onClear={() => {
|
||||
setVstValues(curr => ({
|
||||
...curr,
|
||||
sdModelToken: "",
|
||||
}));
|
||||
}}
|
||||
>
|
||||
{styleModels.map((data: any, key: number) => {
|
||||
const weightProps = { data };
|
||||
console.log(data);
|
||||
return (
|
||||
<WeightsCards type="image_generation" props={weightProps} />
|
||||
);
|
||||
})}
|
||||
</SelectModalV2>
|
||||
|
||||
<SectionAdvanceOptions
|
||||
onChange={handleOnChange}
|
||||
vstValues={vstValues}
|
||||
/>
|
||||
{/* </div>
|
||||
</div>
|
||||
<div className="row g-3 mb-4">
|
||||
<div className="col-12 col-md-6">
|
||||
<NumberSliderV2 {...{
|
||||
min: 1, max: 60, step: 1,
|
||||
initialValue: vstValues.inputFps,
|
||||
label: "Input FPS",
|
||||
thumbTip: "Input FPS",
|
||||
onChange: (val)=>{handleOnChange({inputFps: val})}
|
||||
}}/> */}
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="row g-3 mt-4">
|
||||
@@ -140,10 +144,7 @@ export default function PageVSTApp({
|
||||
<div className="row g-3 mt-4">
|
||||
<div className="col-12 d-flex justify-content-between">
|
||||
<NavLink to={`${parentPath}`}>
|
||||
<Button
|
||||
label={t("button.cancel")}
|
||||
variant="primary"
|
||||
/>
|
||||
<Button label={t("button.cancel")} variant="secondary" />
|
||||
</NavLink>
|
||||
<Button
|
||||
label="Fake Gen"
|
||||
@@ -163,4 +164,4 @@ export default function PageVSTApp({
|
||||
</div>
|
||||
</Panel>
|
||||
);
|
||||
};
|
||||
}
|
||||
+38
-40
@@ -1,4 +1,4 @@
|
||||
import React, {useState} from 'react';
|
||||
import React, { useState } from "react";
|
||||
|
||||
import {
|
||||
faBuildingColumns,
|
||||
@@ -9,18 +9,16 @@ import {
|
||||
// faSparkles,
|
||||
faText,
|
||||
faUser,
|
||||
|
||||
}
|
||||
from "@fortawesome/pro-solid-svg-icons";
|
||||
} from "@fortawesome/pro-solid-svg-icons";
|
||||
|
||||
import {
|
||||
// Accordion,
|
||||
Button,
|
||||
Label,
|
||||
// NumberSliderV2
|
||||
} from 'components/common';
|
||||
import { VSTType } from './helpers';
|
||||
import {
|
||||
} from "components/common";
|
||||
import { VSTType } from "./helpers";
|
||||
import {
|
||||
CNPreset,
|
||||
closeupPreset,
|
||||
halfbodyPreset,
|
||||
@@ -28,36 +26,36 @@ import {
|
||||
landscapePreset,
|
||||
typogPreset,
|
||||
defaultPreset,
|
||||
} from './cnPresets';
|
||||
|
||||
} from "./cnPresets";
|
||||
|
||||
export default function SectionAdvanceOptions({
|
||||
vstValues: vstVal,
|
||||
onChange: handleOnChange
|
||||
}:{
|
||||
vstValues : VSTType,
|
||||
onChange: (val:{[key: string]: number|string|boolean|undefined})=>void
|
||||
}){
|
||||
|
||||
const [preset, pickPreset] = useState<CNPreset>('default')
|
||||
function handlePreset(newPreset: CNPreset){
|
||||
switch (newPreset){
|
||||
case 'closeup':
|
||||
onChange: handleOnChange,
|
||||
}: {
|
||||
vstValues: VSTType;
|
||||
onChange: (val: {
|
||||
[key: string]: number | string | boolean | undefined;
|
||||
}) => void;
|
||||
}) {
|
||||
const [preset, pickPreset] = useState<CNPreset>("default");
|
||||
function handlePreset(newPreset: CNPreset) {
|
||||
switch (newPreset) {
|
||||
case "closeup":
|
||||
handleOnChange(closeupPreset);
|
||||
break;
|
||||
case 'halfbody':
|
||||
case "halfbody":
|
||||
handleOnChange(halfbodyPreset);
|
||||
break;
|
||||
case 'fullbody':
|
||||
case "fullbody":
|
||||
handleOnChange(fullbodyPreset);
|
||||
break;
|
||||
case 'landscape':
|
||||
case "landscape":
|
||||
handleOnChange(landscapePreset);
|
||||
break;
|
||||
case 'typog':
|
||||
case "typog":
|
||||
handleOnChange(typogPreset);
|
||||
break;
|
||||
case 'custom':
|
||||
case "custom":
|
||||
default:
|
||||
handleOnChange(defaultPreset);
|
||||
break;
|
||||
@@ -65,8 +63,8 @@ export default function SectionAdvanceOptions({
|
||||
pickPreset(newPreset);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Label label="Video's Camera Angle"/>
|
||||
<div>
|
||||
<Label label="Video's Camera Angle" />
|
||||
{/* <div className="d-flex flex-wrap w-100">
|
||||
<div className="my-1 me-1">
|
||||
<Button
|
||||
@@ -90,48 +88,48 @@ export default function SectionAdvanceOptions({
|
||||
<Button
|
||||
icon={faStar}
|
||||
label="Default"
|
||||
isActive={preset==='default'}
|
||||
onClick={()=>handlePreset('default')}
|
||||
isActive={preset === "default"}
|
||||
onClick={() => handlePreset("default")}
|
||||
/>
|
||||
</div>
|
||||
<div className="m-1">
|
||||
<Button
|
||||
icon={faFaceViewfinder}
|
||||
label="Face Closeups"
|
||||
isActive={preset==='closeup'}
|
||||
onClick={()=>handlePreset('closeup')}
|
||||
isActive={preset === "closeup"}
|
||||
onClick={() => handlePreset("closeup")}
|
||||
/>
|
||||
</div>
|
||||
<div className="m-1">
|
||||
<Button
|
||||
icon={faUser}
|
||||
label="Half Body Shots"
|
||||
isActive={preset==='halfbody'}
|
||||
onClick={()=>handlePreset('halfbody')}
|
||||
isActive={preset === "halfbody"}
|
||||
onClick={() => handlePreset("halfbody")}
|
||||
/>
|
||||
</div>
|
||||
<div className="m-1">
|
||||
<Button
|
||||
icon={faPerson}
|
||||
label="Full Body Shots"
|
||||
isActive={preset==='fullbody'}
|
||||
onClick={()=>handlePreset('fullbody')}
|
||||
isActive={preset === "fullbody"}
|
||||
onClick={() => handlePreset("fullbody")}
|
||||
/>
|
||||
</div>
|
||||
<div className="m-1">
|
||||
<Button
|
||||
icon={faBuildingColumns}
|
||||
label="Architecture or Landscape"
|
||||
isActive={preset==='landscape'}
|
||||
onClick={()=>handlePreset('landscape')}
|
||||
isActive={preset === "landscape"}
|
||||
onClick={() => handlePreset("landscape")}
|
||||
/>
|
||||
</div>
|
||||
<div className="m-1">
|
||||
<Button
|
||||
icon={faText}
|
||||
label="Flat Logos, or Typographies"
|
||||
isActive={preset==='typog'}
|
||||
onClick={()=>handlePreset('typog')}
|
||||
isActive={preset === "typog"}
|
||||
onClick={() => handlePreset("typog")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -268,6 +266,6 @@ export default function SectionAdvanceOptions({
|
||||
</div>
|
||||
</Accordion.Item>
|
||||
</Accordion> */}
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
const styleModels = [
|
||||
{
|
||||
"weight_token": "weight_yqexh77ntqyawzgh9fzash798",
|
||||
"weight_type": "sd_1.5",
|
||||
"weight_category": "image_generation",
|
||||
"title": "Flat2D Animerge v3",
|
||||
"maybe_cover_image_public_bucket_path": "/media/2/t/5/a/q/2t5aq2nvtdt4zcfvmx8xm6xqzg0tka7n/upload_2t5aq2nvtdt4zcfvmx8xm6xqzg0tka7n.png",
|
||||
"cover_image": {
|
||||
"maybe_cover_image_public_bucket_path": "/media/2/t/5/a/q/2t5aq2nvtdt4zcfvmx8xm6xqzg0tka7n/upload_2t5aq2nvtdt4zcfvmx8xm6xqzg0tka7n.png",
|
||||
"default_cover": {
|
||||
"image_index": 16,
|
||||
"color_index": 2
|
||||
}
|
||||
},
|
||||
"creator": {
|
||||
"user_token": "U:38X9ACM68GFK7",
|
||||
"username": "crossproduct1",
|
||||
"display_name": "crossproduct1",
|
||||
"gravatar_hash": "e7cc43eed149c304c917383c665fe9e2",
|
||||
"default_avatar": {
|
||||
"image_index": 4,
|
||||
"color_index": 8
|
||||
}
|
||||
},
|
||||
"creator_set_visibility": "public",
|
||||
"file_size_bytes": 0,
|
||||
"file_checksum_sha2": "5dd56bfa12e9ea2f1f3e86a04d0d2cde06a58f2cdf3bfc46cbff6aaa8f00921d",
|
||||
"creator_username": "crossproduct1",
|
||||
"creator_display_name": "crossproduct1",
|
||||
"creator_email_gravatar_hash": "e7cc43eed149c304c917383c665fe9e2",
|
||||
"stats": {
|
||||
"positive_rating_count": 2,
|
||||
"bookmark_count": 1
|
||||
},
|
||||
"created_at": "2024-02-28T21:00:43Z",
|
||||
"updated_at": "2024-02-28T21:00:43Z"
|
||||
},
|
||||
]
|
||||
|
||||
export default styleModels;
|
||||
|
||||
Reference in new issue
Block a user