Spaces:
Sleeping
Sleeping
Julian Bilcke
commited on
Commit
·
53fde26
1
Parent(s):
c20780a
adding a secret feature for the nicest users
Browse files
src/app/interface/bottom-bar/bottom-bar.tsx
CHANGED
|
@@ -154,14 +154,9 @@ function BottomBar() {
|
|
| 154 |
*/}
|
| 155 |
{canSeeBetaFeatures ? <Button
|
| 156 |
onClick={downloadClap}
|
| 157 |
-
disabled={!prompt?.length}
|
| 158 |
>
|
| 159 |
-
|
| 160 |
-
remainingImages ? `${allStatus.length - remainingImages}/${allStatus.length} panels ⌛` : `Save .clap`
|
| 161 |
-
}</span>
|
| 162 |
-
<span className="inline md:hidden">{
|
| 163 |
-
remainingImages ? `${allStatus.length - remainingImages}/${allStatus.length} ⌛` : `Save .clap`
|
| 164 |
-
}</span>
|
| 165 |
</Button> : null}
|
| 166 |
<Button
|
| 167 |
onClick={handlePrint}
|
|
|
|
| 154 |
*/}
|
| 155 |
{canSeeBetaFeatures ? <Button
|
| 156 |
onClick={downloadClap}
|
| 157 |
+
disabled={!prompt?.length || remainingImages > 0}
|
| 158 |
>
|
| 159 |
+
{remainingImages ? `${allStatus.length - remainingImages}/${allStatus.length} ⌛` : `Save .clap`}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
</Button> : null}
|
| 161 |
<Button
|
| 162 |
onClick={handlePrint}
|
src/app/store/index.ts
CHANGED
|
@@ -72,7 +72,7 @@ export const useStore = create<{
|
|
| 72 |
|
| 73 |
generate: (prompt: string, presetName: PresetName, layoutName: LayoutName) => void
|
| 74 |
|
| 75 |
-
|
| 76 |
|
| 77 |
downloadClap: () => Promise<void>
|
| 78 |
}>((set, get) => ({
|
|
@@ -406,7 +406,7 @@ export const useStore = create<{
|
|
| 406 |
layouts,
|
| 407 |
})
|
| 408 |
},
|
| 409 |
-
|
| 410 |
const {
|
| 411 |
currentNbPanels,
|
| 412 |
prompt,
|
|
@@ -440,7 +440,9 @@ export const useStore = create<{
|
|
| 440 |
for (let i = 0; i < panels.length; i++) {
|
| 441 |
|
| 442 |
const panel = panels[i]
|
| 443 |
-
|
|
|
|
|
|
|
| 444 |
const renderedScene = renderedScenes[`${i}`]
|
| 445 |
|
| 446 |
clap.segments.push(newSegment({
|
|
@@ -449,7 +451,9 @@ export const useStore = create<{
|
|
| 449 |
assetDurationInMs: defaultSegmentDurationInMs,
|
| 450 |
category: "storyboard",
|
| 451 |
prompt: panel,
|
| 452 |
-
outputType: "image"
|
|
|
|
|
|
|
| 453 |
}))
|
| 454 |
|
| 455 |
clap.segments.push(newSegment({
|
|
@@ -460,7 +464,8 @@ export const useStore = create<{
|
|
| 460 |
prompt: caption,
|
| 461 |
// assetUrl: `data:text/plain;base64,${btoa(title)}`,
|
| 462 |
assetUrl: caption,
|
| 463 |
-
outputType: "text"
|
|
|
|
| 464 |
}))
|
| 465 |
|
| 466 |
clap.segments.push(newSegment({
|
|
@@ -469,7 +474,8 @@ export const useStore = create<{
|
|
| 469 |
assetDurationInMs: defaultSegmentDurationInMs,
|
| 470 |
category: "dialogue",
|
| 471 |
prompt: caption,
|
| 472 |
-
outputType: "audio"
|
|
|
|
| 473 |
}))
|
| 474 |
|
| 475 |
// the presence of a camera is mandatory
|
|
@@ -478,8 +484,9 @@ export const useStore = create<{
|
|
| 478 |
startTimeInMs: currentElapsedTimeInMs,
|
| 479 |
assetDurationInMs: defaultSegmentDurationInMs,
|
| 480 |
category: "camera",
|
| 481 |
-
prompt: "
|
| 482 |
-
outputType: "text"
|
|
|
|
| 483 |
}))
|
| 484 |
|
| 485 |
currentElapsedTimeInMs += defaultSegmentDurationInMs
|
|
@@ -491,9 +498,9 @@ export const useStore = create<{
|
|
| 491 |
},
|
| 492 |
|
| 493 |
downloadClap: async () => {
|
| 494 |
-
const {
|
| 495 |
|
| 496 |
-
const currentClap = await
|
| 497 |
|
| 498 |
if (!currentClap) { throw new Error(`cannot save a clap.. if there is no clap`) }
|
| 499 |
|
|
|
|
| 72 |
|
| 73 |
generate: (prompt: string, presetName: PresetName, layoutName: LayoutName) => void
|
| 74 |
|
| 75 |
+
convertComicToClap: () => Promise<ClapProject>
|
| 76 |
|
| 77 |
downloadClap: () => Promise<void>
|
| 78 |
}>((set, get) => ({
|
|
|
|
| 406 |
layouts,
|
| 407 |
})
|
| 408 |
},
|
| 409 |
+
convertComicToClap: async (): Promise<ClapProject> => {
|
| 410 |
const {
|
| 411 |
currentNbPanels,
|
| 412 |
prompt,
|
|
|
|
| 440 |
for (let i = 0; i < panels.length; i++) {
|
| 441 |
|
| 442 |
const panel = panels[i]
|
| 443 |
+
|
| 444 |
+
const caption = captions[i]
|
| 445 |
+
|
| 446 |
const renderedScene = renderedScenes[`${i}`]
|
| 447 |
|
| 448 |
clap.segments.push(newSegment({
|
|
|
|
| 451 |
assetDurationInMs: defaultSegmentDurationInMs,
|
| 452 |
category: "storyboard",
|
| 453 |
prompt: panel,
|
| 454 |
+
outputType: "image",
|
| 455 |
+
assetUrl: renderedScene?.assetUrl || "",
|
| 456 |
+
status: "completed"
|
| 457 |
}))
|
| 458 |
|
| 459 |
clap.segments.push(newSegment({
|
|
|
|
| 464 |
prompt: caption,
|
| 465 |
// assetUrl: `data:text/plain;base64,${btoa(title)}`,
|
| 466 |
assetUrl: caption,
|
| 467 |
+
outputType: "text",
|
| 468 |
+
status: "completed"
|
| 469 |
}))
|
| 470 |
|
| 471 |
clap.segments.push(newSegment({
|
|
|
|
| 474 |
assetDurationInMs: defaultSegmentDurationInMs,
|
| 475 |
category: "dialogue",
|
| 476 |
prompt: caption,
|
| 477 |
+
outputType: "audio",
|
| 478 |
+
status: "to_generate"
|
| 479 |
}))
|
| 480 |
|
| 481 |
// the presence of a camera is mandatory
|
|
|
|
| 484 |
startTimeInMs: currentElapsedTimeInMs,
|
| 485 |
assetDurationInMs: defaultSegmentDurationInMs,
|
| 486 |
category: "camera",
|
| 487 |
+
prompt: "movie still",
|
| 488 |
+
outputType: "text",
|
| 489 |
+
status: "completed"
|
| 490 |
}))
|
| 491 |
|
| 492 |
currentElapsedTimeInMs += defaultSegmentDurationInMs
|
|
|
|
| 498 |
},
|
| 499 |
|
| 500 |
downloadClap: async () => {
|
| 501 |
+
const { convertComicToClap } = get()
|
| 502 |
|
| 503 |
+
const currentClap = await convertComicToClap()
|
| 504 |
|
| 505 |
if (!currentClap) { throw new Error(`cannot save a clap.. if there is no clap`) }
|
| 506 |
|