diff --git a/README.md b/README.md index fef56b23..01813662 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,10 @@ Google Colab demo: [![Open In Colab](https://colab.research.google.com/assets/co ## Screenshots -| ![musicgen](./screenshots/v2/musicgen.png) | ![rvc](./screenshots/v2/rvc.png) | ![history](./screenshots/v2/history.jpg) | -| :---------------------------------------------------: | :---------------------------------------------------: | :--------------------------------------: | -| ![Screenshot 1](<./screenshots/screenshot%20(1).png>) | ![Screenshot 5](<./screenshots/screenshot%20(5).png>) | ![cloning](./screenshots/v2/cloning.png) | +| ![react](./screenshots/v2/react.png) | ![musicgen](./screenshots/v2/musicgen.png) | ![rvc](./screenshots/v2/rvc.png) | +| :-----------------------------------------: | :-----------------------------------------: | :-------------------------------: | +| ![history](./screenshots/v2/history.jpg) | ![Screenshot 1](<./screenshots/screenshot%20(1).png>) | ![Screenshot 5](<./screenshots/screenshot%20(5).png>) | + ## Examples @@ -40,6 +41,14 @@ https://rsxdalv.github.io/bark-speaker-directory/ https://github.com/rsxdalv/tts-generation-webui/discussions/186#discussioncomment-7291274 ## Changelog +Jan 9: +* React UI + * Fix 404 handler for Wavesurfer + * Group Bark tabs together + +Jan 8: +* Release React UI + Oct 26: * Improve model selection UX for Musicgen diff --git a/react-ui/src/components/AudioComponents.tsx b/react-ui/src/components/AudioComponents.tsx index a8e9d4a3..1c7ccb16 100644 --- a/react-ui/src/components/AudioComponents.tsx +++ b/react-ui/src/components/AudioComponents.tsx @@ -137,7 +137,8 @@ const DownloadButton = ({ url }: { url?: string }) => { .then((blob) => { const blobURL = URL.createObjectURL(blob); setDownloadURL(blobURL); - }); + }) + .catch((e) => console.log("=== Error downloading", e)); }; download(url); }, [url]); diff --git a/react-ui/src/components/Header.tsx b/react-ui/src/components/Header.tsx index 77e5627f..d5d2874e 100644 --- a/react-ui/src/components/Header.tsx +++ b/react-ui/src/components/Header.tsx @@ -2,7 +2,14 @@ import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; -const routes = [ +type Route = { + href: string; + text: string | React.ReactNode; + target?: string; + subroutes?: Route[]; +}; + +const routes: Route[] = [ { href: "/", text: "Home", @@ -10,6 +17,52 @@ const routes = [ { href: "/bark", text: "Bark", + subroutes: [ + { + href: "/bark", + text: "Generation", + }, + // { + // href: "/bark_voice_generation", + // text: "Voice Generation", + // }, + // { + // href: "/voices", + // text: "Voices", + // }, + // { + // href: "/bark_settings", + // text: "Settings", + // }, + // { + // href: "/vocos_wav", + // text: "Vocos Wav", + // }, + // { + // href: "/vocos_npz", + // text: "Vocos NPZ", + // }, + { + href: "/bark/bark_voice_generation", + text: "Voice Generation", + }, + { + href: "/bark/voices", + text: "Voices", + }, + { + href: "/bark/bark_settings", + text: "Settings", + }, + { + href: "/bark/vocos_wav", + text: "Vocos Wav", + }, + { + href: "/bark/vocos_npz", + text: "Vocos NPZ", + }, + ], }, { href: "/tortoise", @@ -19,25 +72,13 @@ const routes = [ href: "/musicgen", text: "Musicgen", }, - { - href: "/rvc", - text: "RVC", - }, { href: "/demucs", text: "Demucs", }, { - href: "/vocos_wav", - text: "Vocos Wav", - }, - { - href: "/vocos_npz", - text: "Vocos NPZ", - }, - { - href: "/bark_voice_generation", - text: "Bark Voice Generation", + href: "/rvc", + text: "RVC", }, { href: "/history/outputs", @@ -47,14 +88,6 @@ const routes = [ href: "/history/favorites", text: "Favorites", }, - { - href: "/voices", - text: "Bark Voices", - }, - { - href: "/bark_settings", - text: "Bark Settings", - }, // { // href: "/history/collections", // text: "History Collections", @@ -69,11 +102,7 @@ const routes = [ // }, { href: "https://echo.ps.ai/?utm_source=bark_speaker_directory", - text: ( - - More Voices{" "}↗ - - ), + text: More Voices ↗, target: "_blank", }, ]; @@ -82,26 +111,55 @@ export const Header = ({}) => { const router = useRouter(); const route = router.asPath.replace("/", ""); + const currentRoute = + routes.find((r) => r.href.slice(1) === route) || + routes.find( + (r) => r.href.slice(1) === route.slice(0, route.lastIndexOf("/")) + ); + + const subroutes = currentRoute?.subroutes; + return ( -
-

- TTS Generation Webui -

-

- {routes.map(({ href, text, target }, i) => ( - - - {text} - - {i < routes.length - 1 && " | "} - - ))} -

-
+ <> +
+

+ TTS Generation Webui +

+

+ {routes.map(({ href, text, target, subroutes }, i) => ( + + + {text} + + {i < routes.length - 1 && " | "} + + ))} +

+
+ {subroutes && ( +
+

+ {currentRoute?.text} {"> "} + {subroutes.map(({ href, text, target }, i) => ( + + + {text} + + {i < subroutes.length - 1 && " | "} + + ))} +

+
+ )} + ); }; diff --git a/react-ui/src/components/Template.tsx b/react-ui/src/components/Template.tsx index 5dafc0cc..dad8c1cb 100644 --- a/react-ui/src/components/Template.tsx +++ b/react-ui/src/components/Template.tsx @@ -9,7 +9,7 @@ export const Template = ({ children }: { children: React.ReactNode }) => (
{children} diff --git a/react-ui/src/components/useWavesurfer.tsx b/react-ui/src/components/useWavesurfer.tsx index f7602217..d74951e5 100644 --- a/react-ui/src/components/useWavesurfer.tsx +++ b/react-ui/src/components/useWavesurfer.tsx @@ -11,11 +11,13 @@ export const useWavesurfer = (containerRef, options: WaveSurferOptions) => { const ws = WaveSurfer.create({ ...options, + url: undefined, container: containerRef.current, }); - + ws.load(options.url!).catch((e) => { + console.log("=== Wavesurfer loading failed", e); + }); setWavesurfer(ws); - return () => { ws.destroy(); }; diff --git a/react-ui/src/pages/bark_settings.tsx b/react-ui/src/pages/bark/bark_settings.tsx similarity index 98% rename from react-ui/src/pages/bark_settings.tsx rename to react-ui/src/pages/bark/bark_settings.tsx index f13e4a73..f7a2b383 100644 --- a/react-ui/src/pages/bark_settings.tsx +++ b/react-ui/src/pages/bark/bark_settings.tsx @@ -1,12 +1,12 @@ import React from "react"; -import { Template } from "../components/Template"; +import { Template } from "../../components/Template"; import Head from "next/head"; -import useLocalStorage from "../hooks/useLocalStorage"; +import useLocalStorage from "../../hooks/useLocalStorage"; import { BarkSettingsParams, initialBarkSettingsParams, barkSettingsId, -} from "../tabs/BarkSettingsParams"; +} from "../../tabs/BarkSettingsParams"; type Result = string; diff --git a/react-ui/src/pages/bark_voice_generation.tsx b/react-ui/src/pages/bark/bark_voice_generation.tsx similarity index 94% rename from react-ui/src/pages/bark_voice_generation.tsx rename to react-ui/src/pages/bark/bark_voice_generation.tsx index 10baad39..e2e63058 100644 --- a/react-ui/src/pages/bark_voice_generation.tsx +++ b/react-ui/src/pages/bark/bark_voice_generation.tsx @@ -1,14 +1,14 @@ import React from "react"; -import { Template } from "../components/Template"; -import useLocalStorage from "../hooks/useLocalStorage"; -import { AudioInput, AudioOutput } from "../components/AudioComponents"; +import { Template } from "../../components/Template"; +import useLocalStorage from "../../hooks/useLocalStorage"; +import { AudioInput, AudioOutput } from "../../components/AudioComponents"; import Head from "next/head"; import { BarkVoiceGenerationParams, barkVoiceGenerationId, initialState, -} from "../tabs/BarkVoiceGenerationParams"; -import { GradioFile } from "../types/GradioFile"; +} from "../../tabs/BarkVoiceGenerationParams"; +import { GradioFile } from "../../types/GradioFile"; type Result = { filename: string; diff --git a/react-ui/src/pages/vocos_npz.tsx b/react-ui/src/pages/bark/vocos_npz.tsx similarity index 84% rename from react-ui/src/pages/vocos_npz.tsx rename to react-ui/src/pages/bark/vocos_npz.tsx index b88de480..e696920e 100644 --- a/react-ui/src/pages/vocos_npz.tsx +++ b/react-ui/src/pages/bark/vocos_npz.tsx @@ -1,15 +1,15 @@ import React from "react"; -import { Template } from "../components/Template"; -import useLocalStorage from "../hooks/useLocalStorage"; -import { AudioInput, AudioOutput } from "../components/AudioComponents"; +import { Template } from "../../components/Template"; +import useLocalStorage from "../../hooks/useLocalStorage"; +import { AudioInput, AudioOutput } from "../../components/AudioComponents"; import Head from "next/head"; import { VocosParamsNPZ, vocosIdNPZ, initialState, -} from "../tabs/VocosParamsNPZ"; -import { GradioFile } from "../types/GradioFile"; -import FileInput from "../components/FileInput"; +} from "../../tabs/VocosParamsNPZ"; +import { GradioFile } from "../../types/GradioFile"; +import FileInput from "../../components/FileInput"; const VocosPageNPZ = () => { const [data, setData] = useLocalStorage( @@ -50,7 +50,7 @@ const VocosPageNPZ = () => { Vocos - TTS Generation Webui -
+
{ Vocos - TTS Generation Webui -
+