Spaces:
Paused
Paused
Commit
โข
d90835a
1
Parent(s):
45e9015
renamed to LifeSim
Browse files- README.md +2 -2
- package-lock.json +3 -3
- src/app/layout.tsx +2 -2
- src/app/main.tsx +3 -49
- src/app/scenes/ants.ts +38 -0
- src/app/scenes/fishTank.ts +41 -0
- src/app/scenes/pick.ts +2 -0
- src/app/scenes/types.ts +7 -0
- src/components/business/video-player.tsx +1 -1
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: ๐ ๐ชธ
|
4 |
colorFrom: blue
|
5 |
colorTo: yellow
|
@@ -8,4 +8,4 @@ pinned: false
|
|
8 |
app_port: 3000
|
9 |
---
|
10 |
|
11 |
-
|
|
|
1 |
---
|
2 |
+
title: LifeSim
|
3 |
emoji: ๐ ๐ชธ
|
4 |
colorFrom: blue
|
5 |
colorTo: yellow
|
|
|
8 |
app_port: 3000
|
9 |
---
|
10 |
|
11 |
+
LifeSim uses a text-to-video model to render artificially simulated scenes.
|
package-lock.json
CHANGED
@@ -2608,9 +2608,9 @@
|
|
2608 |
}
|
2609 |
},
|
2610 |
"node_modules/electron-to-chromium": {
|
2611 |
-
"version": "1.4.
|
2612 |
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.
|
2613 |
-
"integrity": "sha512-
|
2614 |
},
|
2615 |
"node_modules/emoji-regex": {
|
2616 |
"version": "9.2.2",
|
|
|
2608 |
}
|
2609 |
},
|
2610 |
"node_modules/electron-to-chromium": {
|
2611 |
+
"version": "1.4.470",
|
2612 |
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.470.tgz",
|
2613 |
+
"integrity": "sha512-zZM48Lmy2FKWgqyvsX9XK+J6FfP7aCDUFLmgooLJzA7v1agCs/sxSoBpTIwDLhmbhpx9yJIxj2INig/ncjJRqg=="
|
2614 |
},
|
2615 |
"node_modules/emoji-regex": {
|
2616 |
"version": "9.2.2",
|
src/app/layout.tsx
CHANGED
@@ -5,8 +5,8 @@ import { Inter } from 'next/font/google'
|
|
5 |
const inter = Inter({ subsets: ['latin'] })
|
6 |
|
7 |
export const metadata: Metadata = {
|
8 |
-
title: '
|
9 |
-
description: '
|
10 |
}
|
11 |
|
12 |
export default function RootLayout({
|
|
|
5 |
const inter = Inter({ subsets: ['latin'] })
|
6 |
|
7 |
export const metadata: Metadata = {
|
8 |
+
title: 'LifeSim ๐ ๐ชธ',
|
9 |
+
description: 'LifeSim',
|
10 |
}
|
11 |
|
12 |
export default function RootLayout({
|
src/app/main.tsx
CHANGED
@@ -4,54 +4,8 @@ import { useEffect, useState, useTransition } from "react"
|
|
4 |
|
5 |
import { VideoPlayer } from "@/components/business/video-player"
|
6 |
import { renderScene } from "./renderScene"
|
7 |
-
|
8 |
-
|
9 |
-
const actions = [
|
10 |
-
"idling",
|
11 |
-
"making bubbles",
|
12 |
-
"making circles",
|
13 |
-
"opening and closing its mouth",
|
14 |
-
// "with an octopus",
|
15 |
-
"playing with another fish",
|
16 |
-
"eating fishfood",
|
17 |
-
"eating a crab",
|
18 |
-
"attacked by a jellyfish"
|
19 |
-
]
|
20 |
-
|
21 |
-
const positions = [
|
22 |
-
"at the top of the coral",
|
23 |
-
"at the bottom of the coral",
|
24 |
-
"centered in the middle",
|
25 |
-
"burrowing in the sand",
|
26 |
-
"hiding in the coral"
|
27 |
-
]
|
28 |
-
|
29 |
-
const pick = (items: string[]) => items[Math.floor(Math.random()*items.length)]
|
30 |
-
|
31 |
-
const getScene = () => {
|
32 |
-
const action = pick(actions)
|
33 |
-
const position = pick(positions)
|
34 |
-
|
35 |
-
const prompt = [
|
36 |
-
`medium shot of a clownfish`,
|
37 |
-
action,
|
38 |
-
position,
|
39 |
-
`in front of yellow coral`,
|
40 |
-
`high res underwater footage`,
|
41 |
-
].join(", ")
|
42 |
-
|
43 |
-
return {
|
44 |
-
action,
|
45 |
-
position,
|
46 |
-
prompt
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
interface Scene {
|
51 |
-
action: string
|
52 |
-
position: string
|
53 |
-
prompt: string
|
54 |
-
}
|
55 |
|
56 |
export default function Main() {
|
57 |
const [url, setUrl] = useState<string>()
|
@@ -65,7 +19,7 @@ export default function Main() {
|
|
65 |
|
66 |
startTransition(async () => {
|
67 |
|
68 |
-
console.log(`generating new
|
69 |
const newScene = getScene()
|
70 |
|
71 |
const newUrl = await renderScene(newScene.prompt)
|
|
|
4 |
|
5 |
import { VideoPlayer } from "@/components/business/video-player"
|
6 |
import { renderScene } from "./renderScene"
|
7 |
+
import { Scene } from "./scenes/types"
|
8 |
+
import { getScene } from "./scenes/ants"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
export default function Main() {
|
11 |
const [url, setUrl] = useState<string>()
|
|
|
19 |
|
20 |
startTransition(async () => {
|
21 |
|
22 |
+
console.log(`generating new scene..`)
|
23 |
const newScene = getScene()
|
24 |
|
25 |
const newUrl = await renderScene(newScene.prompt)
|
src/app/scenes/ants.ts
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { pick } from "./pick"
|
2 |
+
|
3 |
+
const actions = [
|
4 |
+
"working on lavae",
|
5 |
+
"slicing leaves",
|
6 |
+
"attacking a beetle",
|
7 |
+
"foraging",
|
8 |
+
"cutting a sugar cube",
|
9 |
+
"collecting sugar",
|
10 |
+
"collecting aphids"
|
11 |
+
]
|
12 |
+
|
13 |
+
const positions = [
|
14 |
+
"on a leave",
|
15 |
+
"on a tree branch",
|
16 |
+
"on sand",
|
17 |
+
"on the ground"
|
18 |
+
]
|
19 |
+
|
20 |
+
export const getScene = () => {
|
21 |
+
const action = pick(actions)
|
22 |
+
const position = pick(positions)
|
23 |
+
|
24 |
+
const prompt = [
|
25 |
+
`close-up shot of a couple of ants`,
|
26 |
+
action,
|
27 |
+
position,
|
28 |
+
`high res`,
|
29 |
+
`documentary`,
|
30 |
+
].join(", ")
|
31 |
+
|
32 |
+
return {
|
33 |
+
name: "Ants",
|
34 |
+
action,
|
35 |
+
position,
|
36 |
+
prompt
|
37 |
+
}
|
38 |
+
}
|
src/app/scenes/fishTank.ts
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { pick } from "./pick"
|
2 |
+
|
3 |
+
const actions = [
|
4 |
+
"idling",
|
5 |
+
"making bubbles",
|
6 |
+
"making circles",
|
7 |
+
"opening and closing its mouth",
|
8 |
+
// "with an octopus",
|
9 |
+
"playing with another fish",
|
10 |
+
"eating fishfood",
|
11 |
+
"eating a crab",
|
12 |
+
"attacked by a jellyfish"
|
13 |
+
]
|
14 |
+
|
15 |
+
const positions = [
|
16 |
+
"at the top of the coral",
|
17 |
+
"at the bottom of the coral",
|
18 |
+
"centered in the middle",
|
19 |
+
"burrowing in the sand",
|
20 |
+
"hiding in the coral"
|
21 |
+
]
|
22 |
+
|
23 |
+
export const getScene = () => {
|
24 |
+
const action = pick(actions)
|
25 |
+
const position = pick(positions)
|
26 |
+
|
27 |
+
const prompt = [
|
28 |
+
`medium shot of a clownfish`,
|
29 |
+
action,
|
30 |
+
position,
|
31 |
+
`in front of yellow coral`,
|
32 |
+
`high res underwater footage`,
|
33 |
+
].join(", ")
|
34 |
+
|
35 |
+
return {
|
36 |
+
name: "FishTank",
|
37 |
+
action,
|
38 |
+
position,
|
39 |
+
prompt
|
40 |
+
}
|
41 |
+
}
|
src/app/scenes/pick.ts
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
|
2 |
+
export const pick = (items: string[]) => items[Math.floor(Math.random()*items.length)]
|
src/app/scenes/types.ts
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
export interface Scene {
|
3 |
+
name: string
|
4 |
+
action: string
|
5 |
+
position: string
|
6 |
+
prompt: string
|
7 |
+
}
|
src/components/business/video-player.tsx
CHANGED
@@ -4,7 +4,7 @@ export const VideoPlayer = ({ url }: { url?: string }) => {
|
|
4 |
|
5 |
if (!url) {
|
6 |
return <div className="flex w-full h-screen items-center justify-center text-center">
|
7 |
-
<div>
|
8 |
</div>
|
9 |
}
|
10 |
|
|
|
4 |
|
5 |
if (!url) {
|
6 |
return <div className="flex w-full h-screen items-center justify-center text-center">
|
7 |
+
<div>Generating first frames.. (might take around 30s)</div>
|
8 |
</div>
|
9 |
}
|
10 |
|