Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
β’
5724388
1
Parent(s):
1763a89
upgrade clap
Browse files- .nvmrc +1 -1
- package-lock.json +0 -0
- package.json +3 -3
- src/app/layouts/settings.tsx +26 -26
- src/app/store/index.ts +9 -6
- src/lib/getImageDimension.ts +6 -6
- src/lib/useImageDimension.ts +2 -2
.nvmrc
CHANGED
@@ -1 +1 @@
|
|
1 |
-
v20.
|
|
|
1 |
+
v20.17.0
|
package-lock.json
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
{
|
2 |
"name": "@jbilcke/comic-factory",
|
3 |
-
"version": "1.2.
|
4 |
"private": true,
|
5 |
"scripts": {
|
6 |
"dev": "next dev",
|
@@ -9,7 +9,7 @@
|
|
9 |
"lint": "next lint"
|
10 |
},
|
11 |
"dependencies": {
|
12 |
-
"@aitube/clap": "0.
|
13 |
"@anthropic-ai/sdk": "^0.25.0",
|
14 |
"@huggingface/hub": "^0.15.1",
|
15 |
"@huggingface/inference": "^2.0.0",
|
@@ -49,7 +49,7 @@
|
|
49 |
"i": "^0.3.7",
|
50 |
"konva": "^9.2.2",
|
51 |
"lucide-react": "^0.260.0",
|
52 |
-
"next": "14.2.
|
53 |
"npm": "^10.7.0",
|
54 |
"openai": "^4.29.2",
|
55 |
"pick": "^0.0.1",
|
|
|
1 |
{
|
2 |
"name": "@jbilcke/comic-factory",
|
3 |
+
"version": "1.2.3",
|
4 |
"private": true,
|
5 |
"scripts": {
|
6 |
"dev": "next dev",
|
|
|
9 |
"lint": "next lint"
|
10 |
},
|
11 |
"dependencies": {
|
12 |
+
"@aitube/clap": "0.2.4",
|
13 |
"@anthropic-ai/sdk": "^0.25.0",
|
14 |
"@huggingface/hub": "^0.15.1",
|
15 |
"@huggingface/inference": "^2.0.0",
|
|
|
49 |
"i": "^0.3.7",
|
50 |
"konva": "^9.2.2",
|
51 |
"lucide-react": "^0.260.0",
|
52 |
+
"next": "14.2.7",
|
53 |
"npm": "^10.7.0",
|
54 |
"openai": "^4.29.2",
|
55 |
"pick": "^0.0.1",
|
src/app/layouts/settings.tsx
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
import {
|
2 |
|
3 |
import { LayoutName } from "."
|
4 |
|
5 |
export type LayoutSettings = {
|
6 |
panel: number
|
7 |
-
orientation:
|
8 |
width: number
|
9 |
height: number
|
10 |
}
|
@@ -12,41 +12,41 @@ export type LayoutSettings = {
|
|
12 |
export const layouts: Record<LayoutName, LayoutSettings[]> = {
|
13 |
random: [],
|
14 |
Layout0: [
|
15 |
-
{ panel: 0, orientation:
|
16 |
-
{ panel: 1, orientation:
|
17 |
-
{ panel: 2, orientation:
|
18 |
-
{ panel: 3, orientation:
|
19 |
],
|
20 |
Layout1: [
|
21 |
-
{ panel: 0, orientation:
|
22 |
-
{ panel: 1, orientation:
|
23 |
-
{ panel: 2, orientation:
|
24 |
-
{ panel: 3, orientation:
|
25 |
],
|
26 |
Layout2: [
|
27 |
-
{ panel: 0, orientation:
|
28 |
-
{ panel: 1, orientation:
|
29 |
-
{ panel: 2, orientation:
|
30 |
-
{ panel: 3, orientation:
|
31 |
],
|
32 |
Layout3: [
|
33 |
-
{ panel: 0, orientation:
|
34 |
-
{ panel: 1, orientation:
|
35 |
-
{ panel: 2, orientation:
|
36 |
-
{ panel: 3, orientation:
|
37 |
],
|
38 |
Layout4: [
|
39 |
-
{ panel: 0, orientation:
|
40 |
-
{ panel: 1, orientation:
|
41 |
-
{ panel: 2, orientation:
|
42 |
-
{ panel: 3, orientation:
|
43 |
],
|
44 |
}
|
45 |
/*
|
46 |
Layout5: [
|
47 |
-
{ panel: 0, orientation:
|
48 |
-
{ panel: 1, orientation:
|
49 |
-
{ panel: 2, orientation:
|
50 |
-
{ panel: 3, orientation:
|
51 |
]
|
52 |
*/
|
|
|
1 |
+
import { ClapImageRatio } from "@aitube/clap"
|
2 |
|
3 |
import { LayoutName } from "."
|
4 |
|
5 |
export type LayoutSettings = {
|
6 |
panel: number
|
7 |
+
orientation: ClapImageRatio
|
8 |
width: number
|
9 |
height: number
|
10 |
}
|
|
|
12 |
export const layouts: Record<LayoutName, LayoutSettings[]> = {
|
13 |
random: [],
|
14 |
Layout0: [
|
15 |
+
{ panel: 0, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
16 |
+
{ panel: 1, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
17 |
+
{ panel: 2, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
18 |
+
{ panel: 3, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
19 |
],
|
20 |
Layout1: [
|
21 |
+
{ panel: 0, orientation: ClapImageRatio.LANDSCAPE, width: 1024, height: 768 },
|
22 |
+
{ panel: 1, orientation: ClapImageRatio.PORTRAIT, width: 768, height: 1024 },
|
23 |
+
{ panel: 2, orientation: ClapImageRatio.PORTRAIT, width: 768, height: 1024 },
|
24 |
+
{ panel: 3, orientation: ClapImageRatio.LANDSCAPE, width: 1024, height: 768 },
|
25 |
],
|
26 |
Layout2: [
|
27 |
+
{ panel: 0, orientation: ClapImageRatio.PORTRAIT, width: 768, height: 1024 },
|
28 |
+
{ panel: 1, orientation: ClapImageRatio.PORTRAIT, width: 768, height: 1024 },
|
29 |
+
{ panel: 2, orientation: ClapImageRatio.PORTRAIT, width: 512, height: 1024 },
|
30 |
+
{ panel: 3, orientation: ClapImageRatio.LANDSCAPE, width: 1024, height: 768 },
|
31 |
],
|
32 |
Layout3: [
|
33 |
+
{ panel: 0, orientation: ClapImageRatio.LANDSCAPE, width: 1024, height: 768 },
|
34 |
+
{ panel: 1, orientation: ClapImageRatio.PORTRAIT, width: 768, height: 1024 },
|
35 |
+
{ panel: 2, orientation: ClapImageRatio.PORTRAIT, width: 768, height: 1024 },
|
36 |
+
{ panel: 3, orientation: ClapImageRatio.LANDSCAPE, width: 1024, height: 768 },
|
37 |
],
|
38 |
Layout4: [
|
39 |
+
{ panel: 0, orientation: ClapImageRatio.PORTRAIT, width: 512, height: 1024 },
|
40 |
+
{ panel: 1, orientation: ClapImageRatio.LANDSCAPE, width: 1024, height: 768 },
|
41 |
+
{ panel: 2, orientation: ClapImageRatio.PORTRAIT, width: 768, height: 1024 },
|
42 |
+
{ panel: 3, orientation: ClapImageRatio.LANDSCAPE, width: 1024, height: 512 },
|
43 |
],
|
44 |
}
|
45 |
/*
|
46 |
Layout5: [
|
47 |
+
{ panel: 0, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
48 |
+
{ panel: 1, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
49 |
+
{ panel: 2, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
50 |
+
{ panel: 3, orientation: ClapImageRatio.SQUARE, width: 1024, height: 1024 },
|
51 |
]
|
52 |
*/
|
src/app/store/index.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
"use client"
|
2 |
|
3 |
import { create } from "zustand"
|
4 |
-
import { ClapProject,
|
5 |
|
6 |
import { FontName } from "@/lib/fonts"
|
7 |
import { Preset, PresetName, defaultPreset, getPreset, getRandomPreset } from "@/app/engine/presets"
|
@@ -483,16 +483,19 @@ export const useStore = create<{
|
|
483 |
meta: {
|
484 |
title: "Untitled", // we don't need a title actually
|
485 |
description: prompt,
|
486 |
-
|
|
|
|
|
487 |
synopsis: "",
|
488 |
licence: "",
|
489 |
-
|
490 |
width: 512,
|
491 |
height: 288,
|
492 |
isInteractive: false,
|
493 |
isLoop: false,
|
494 |
durationInMs: panels.length * defaultSegmentDurationInMs,
|
495 |
-
|
|
|
496 |
}
|
497 |
})
|
498 |
|
@@ -508,7 +511,7 @@ export const useStore = create<{
|
|
508 |
track: 1,
|
509 |
startTimeInMs: currentElapsedTimeInMs,
|
510 |
assetDurationInMs: defaultSegmentDurationInMs,
|
511 |
-
category: ClapSegmentCategory.
|
512 |
prompt: panel,
|
513 |
outputType: ClapOutputType.IMAGE,
|
514 |
assetUrl: renderedScene?.assetUrl || "",
|
@@ -587,7 +590,7 @@ export const useStore = create<{
|
|
587 |
ClapSegmentFilteringMode.START,
|
588 |
cameraShot,
|
589 |
clap.segments,
|
590 |
-
ClapSegmentCategory.
|
591 |
).at(0) as (ClapSegment | undefined),
|
592 |
ui: filterSegments(
|
593 |
ClapSegmentFilteringMode.START,
|
|
|
1 |
"use client"
|
2 |
|
3 |
import { create } from "zustand"
|
4 |
+
import { ClapProject, ClapImageRatio, ClapSegment, ClapSegmentCategory, ClapSegmentStatus, ClapOutputType, ClapSegmentFilteringMode, filterSegments, newClap, newSegment, parseClap, serializeClap } from "@aitube/clap"
|
5 |
|
6 |
import { FontName } from "@/lib/fonts"
|
7 |
import { Preset, PresetName, defaultPreset, getPreset, getRandomPreset } from "@/app/engine/presets"
|
|
|
483 |
meta: {
|
484 |
title: "Untitled", // we don't need a title actually
|
485 |
description: prompt,
|
486 |
+
storyPrompt: prompt,
|
487 |
+
imagePrompt: "",
|
488 |
+
systemPrompt: "",
|
489 |
synopsis: "",
|
490 |
licence: "",
|
491 |
+
imageRatio: ClapImageRatio.LANDSCAPE,
|
492 |
width: 512,
|
493 |
height: 288,
|
494 |
isInteractive: false,
|
495 |
isLoop: false,
|
496 |
durationInMs: panels.length * defaultSegmentDurationInMs,
|
497 |
+
bpm: 1,
|
498 |
+
frameRate: 1,
|
499 |
}
|
500 |
})
|
501 |
|
|
|
511 |
track: 1,
|
512 |
startTimeInMs: currentElapsedTimeInMs,
|
513 |
assetDurationInMs: defaultSegmentDurationInMs,
|
514 |
+
category: ClapSegmentCategory.IMAGE,
|
515 |
prompt: panel,
|
516 |
outputType: ClapOutputType.IMAGE,
|
517 |
assetUrl: renderedScene?.assetUrl || "",
|
|
|
590 |
ClapSegmentFilteringMode.START,
|
591 |
cameraShot,
|
592 |
clap.segments,
|
593 |
+
ClapSegmentCategory.IMAGE,
|
594 |
).at(0) as (ClapSegment | undefined),
|
595 |
ui: filterSegments(
|
596 |
ClapSegmentFilteringMode.START,
|
src/lib/getImageDimension.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
import {
|
2 |
|
3 |
export interface ImageDimension {
|
4 |
width: number
|
5 |
height: number
|
6 |
-
orientation:
|
7 |
}
|
8 |
|
9 |
export async function getImageDimension(src: string): Promise<ImageDimension> {
|
10 |
if (!src) {
|
11 |
-
return { width: 0, height: 0, orientation:
|
12 |
}
|
13 |
const img = new Image()
|
14 |
img.src = src
|
@@ -16,11 +16,11 @@ export async function getImageDimension(src: string): Promise<ImageDimension> {
|
|
16 |
const width = img.width
|
17 |
const height = img.height
|
18 |
|
19 |
-
let orientation =
|
20 |
if (width > height) {
|
21 |
-
orientation =
|
22 |
} else if (width < height) {
|
23 |
-
orientation =
|
24 |
}
|
25 |
return { width, height, orientation }
|
26 |
}
|
|
|
1 |
+
import { ClapImageRatio } from "@aitube/clap"
|
2 |
|
3 |
export interface ImageDimension {
|
4 |
width: number
|
5 |
height: number
|
6 |
+
orientation: ClapImageRatio
|
7 |
}
|
8 |
|
9 |
export async function getImageDimension(src: string): Promise<ImageDimension> {
|
10 |
if (!src) {
|
11 |
+
return { width: 0, height: 0, orientation: ClapImageRatio.SQUARE }
|
12 |
}
|
13 |
const img = new Image()
|
14 |
img.src = src
|
|
|
16 |
const width = img.width
|
17 |
const height = img.height
|
18 |
|
19 |
+
let orientation = ClapImageRatio.SQUARE
|
20 |
if (width > height) {
|
21 |
+
orientation = ClapImageRatio.LANDSCAPE
|
22 |
} else if (width < height) {
|
23 |
+
orientation = ClapImageRatio.PORTRAIT
|
24 |
}
|
25 |
return { width, height, orientation }
|
26 |
}
|
src/lib/useImageDimension.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
import { useEffect, useState } from "react"
|
2 |
|
3 |
import { ImageDimension, getImageDimension } from "./getImageDimension"
|
4 |
-
import {
|
5 |
|
6 |
export function useImageDimension(src: string) {
|
7 |
const [dimension, setDimension] = useState<ImageDimension>({
|
8 |
width: 0,
|
9 |
height: 0,
|
10 |
-
orientation:
|
11 |
})
|
12 |
|
13 |
useEffect(() => {
|
|
|
1 |
import { useEffect, useState } from "react"
|
2 |
|
3 |
import { ImageDimension, getImageDimension } from "./getImageDimension"
|
4 |
+
import { ClapImageRatio } from "@aitube/clap"
|
5 |
|
6 |
export function useImageDimension(src: string) {
|
7 |
const [dimension, setDimension] = useState<ImageDimension>({
|
8 |
width: 0,
|
9 |
height: 0,
|
10 |
+
orientation: ClapImageRatio.SQUARE
|
11 |
})
|
12 |
|
13 |
useEffect(() => {
|