Spaces:
Runtime error
Runtime error
Commit
β’
888548a
1
Parent(s):
038c38b
removing support for Replicate
Browse files- .env +1 -13
- .nvmrc +1 -1
- README.md +5 -5
- package-lock.json +0 -0
- package.json +51 -52
- src/app/engine/community.ts +2 -2
- src/app/engine/render.ts +2 -13
- src/app/firehose/page.tsx +1 -1
- src/app/generate/page.tsx +10 -6
- src/app/interface/about/index.tsx +3 -3
- src/app/interface/bottom-bar/index.tsx +3 -3
- src/app/interface/top-menu/index.tsx +5 -5
- src/app/layout.tsx +1 -1
.env
CHANGED
@@ -1,15 +1,3 @@
|
|
1 |
-
# ------------- IMAGE API CONFIG --------------
|
2 |
-
# Supported values:
|
3 |
-
# - REPLICATE
|
4 |
-
# - VIDEOCHAIN
|
5 |
-
RENDERING_ENGINE="REPLICATE"
|
6 |
-
|
7 |
-
VIDEOCHAIN_API_URL="http://localhost:7860"
|
8 |
-
VIDEOCHAIN_API_TOKEN=
|
9 |
-
|
10 |
-
REPLICATE_API_TOKEN=
|
11 |
-
REPLICATE_API_MODEL="lucataco/sdxl-panoramic"
|
12 |
-
REPLICATE_API_MODEL_VERSION="76acc4075d0633dcb3823c1fed0419de21d42001b65c816c7b5b9beff30ec8cd"
|
13 |
|
14 |
# ----------- CENSORSHIP -------
|
15 |
# Due to abuse by users, I've had to add a censorship/fingerprinting mechanism
|
@@ -19,7 +7,7 @@ MODERATION_KEY=
|
|
19 |
|
20 |
# ----------- COMMUNITY SHARING (OPTIONAL, YOU DON'T NEED THIS IN LOCAL) -----------
|
21 |
NEXT_PUBLIC_ENABLE_COMMUNITY_SHARING="false"
|
22 |
-
# You don't need those community sharing options to run
|
23 |
# locally or on your own server (they are meant to be used by the Hugging Face team)
|
24 |
COMMUNITY_API_URL=
|
25 |
COMMUNITY_API_TOKEN=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
# ----------- CENSORSHIP -------
|
3 |
# Due to abuse by users, I've had to add a censorship/fingerprinting mechanism
|
|
|
7 |
|
8 |
# ----------- COMMUNITY SHARING (OPTIONAL, YOU DON'T NEED THIS IN LOCAL) -----------
|
9 |
NEXT_PUBLIC_ENABLE_COMMUNITY_SHARING="false"
|
10 |
+
# You don't need those community sharing options to run Text-to-panorama
|
11 |
# locally or on your own server (they are meant to be used by the Hugging Face team)
|
12 |
COMMUNITY_API_URL=
|
13 |
COMMUNITY_API_TOKEN=
|
.nvmrc
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
|
|
1 |
+
v20.9.0
|
README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: true
|
8 |
app_port: 3000
|
9 |
---
|
10 |
|
11 |
-
#
|
|
|
1 |
---
|
2 |
+
title: Text to panorama
|
3 |
+
emoji: π©ποΈ
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: green
|
6 |
sdk: docker
|
7 |
pinned: true
|
8 |
app_port: 3000
|
9 |
---
|
10 |
|
11 |
+
# Text to panorama
|
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/
|
3 |
-
"version": "0.0.
|
4 |
"private": true,
|
5 |
"scripts": {
|
6 |
"dev": "next dev",
|
@@ -9,69 +9,68 @@
|
|
9 |
"lint": "next lint"
|
10 |
},
|
11 |
"dependencies": {
|
12 |
-
"@
|
13 |
-
"@photo-sphere-viewer/core": "
|
14 |
-
"@photo-sphere-viewer/markers-plugin": "
|
15 |
-
"@photo-sphere-viewer/video-plugin": "
|
16 |
-
"@photo-sphere-viewer/virtual-tour-plugin": "
|
17 |
-
"@radix-ui/react-accordion": "
|
18 |
-
"@radix-ui/react-avatar": "
|
19 |
-
"@radix-ui/react-checkbox": "
|
20 |
-
"@radix-ui/react-collapsible": "
|
21 |
-
"@radix-ui/react-dialog": "
|
22 |
-
"@radix-ui/react-dropdown-menu": "
|
23 |
-
"@radix-ui/react-icons": "
|
24 |
-
"@radix-ui/react-label": "
|
25 |
-
"@radix-ui/react-menubar": "
|
26 |
-
"@radix-ui/react-popover": "
|
27 |
-
"@radix-ui/react-select": "
|
28 |
-
"@radix-ui/react-separator": "
|
29 |
-
"@radix-ui/react-slider": "
|
30 |
-
"@radix-ui/react-slot": "
|
31 |
-
"@radix-ui/react-switch": "
|
32 |
-
"@radix-ui/react-toast": "
|
33 |
-
"@radix-ui/react-tooltip": "
|
34 |
-
"@react-pdf/renderer": "
|
35 |
"@types/node": "20.4.2",
|
36 |
"@types/react": "18.2.15",
|
37 |
"@types/react-dom": "18.2.7",
|
38 |
-
"@types/uuid": "
|
39 |
"autoprefixer": "10.4.14",
|
40 |
-
"class-variance-authority": "
|
41 |
-
"clsx": "
|
42 |
-
"cmdk": "
|
43 |
-
"cookies-next": "
|
44 |
-
"date-fns": "
|
45 |
"eslint": "8.45.0",
|
46 |
"eslint-config-next": "13.4.10",
|
47 |
-
"html2canvas": "
|
48 |
-
"lucide-react": "
|
49 |
"next": "13.4.10",
|
50 |
-
"photo-sphere-viewer-lensflare-plugin": "
|
51 |
-
"pick": "
|
52 |
"postcss": "8.4.26",
|
53 |
"react": "18.2.0",
|
54 |
-
"react-circular-progressbar": "
|
55 |
"react-dom": "18.2.0",
|
56 |
-
"react-photo-sphere-viewer": "
|
57 |
-
"react-virtualized-auto-sizer": "
|
58 |
-
"
|
59 |
-
"
|
60 |
-
"
|
61 |
-
"
|
62 |
-
"tailwind-merge": "^1.13.2",
|
63 |
"tailwindcss": "3.3.3",
|
64 |
-
"tailwindcss-animate": "
|
65 |
-
"tesseract.js": "
|
66 |
-
"ts-node": "
|
67 |
"typescript": "5.1.6",
|
68 |
-
"usehooks-ts": "
|
69 |
-
"uuid": "
|
70 |
-
"zustand": "
|
71 |
},
|
72 |
"devDependencies": {
|
73 |
-
"@types/qs": "
|
74 |
-
"@types/react-virtualized": "
|
75 |
-
"@types/sbd": "
|
76 |
}
|
77 |
}
|
|
|
1 |
{
|
2 |
+
"name": "@jbilcke/text-to-panorama",
|
3 |
+
"version": "0.0.2",
|
4 |
"private": true,
|
5 |
"scripts": {
|
6 |
"dev": "next dev",
|
|
|
9 |
"lint": "next lint"
|
10 |
},
|
11 |
"dependencies": {
|
12 |
+
"@gradio/client": "1.2.1",
|
13 |
+
"@photo-sphere-viewer/core": "5.1.7",
|
14 |
+
"@photo-sphere-viewer/markers-plugin": "5.1.7",
|
15 |
+
"@photo-sphere-viewer/video-plugin": "5.1.7",
|
16 |
+
"@photo-sphere-viewer/virtual-tour-plugin": "5.1.7",
|
17 |
+
"@radix-ui/react-accordion": "1.1.2",
|
18 |
+
"@radix-ui/react-avatar": "1.0.3",
|
19 |
+
"@radix-ui/react-checkbox": "1.0.4",
|
20 |
+
"@radix-ui/react-collapsible": "1.0.3",
|
21 |
+
"@radix-ui/react-dialog": "1.0.4",
|
22 |
+
"@radix-ui/react-dropdown-menu": "2.0.5",
|
23 |
+
"@radix-ui/react-icons": "1.3.0",
|
24 |
+
"@radix-ui/react-label": "2.0.2",
|
25 |
+
"@radix-ui/react-menubar": "1.0.3",
|
26 |
+
"@radix-ui/react-popover": "1.0.6",
|
27 |
+
"@radix-ui/react-select": "1.2.2",
|
28 |
+
"@radix-ui/react-separator": "1.0.3",
|
29 |
+
"@radix-ui/react-slider": "1.1.2",
|
30 |
+
"@radix-ui/react-slot": "1.0.2",
|
31 |
+
"@radix-ui/react-switch": "1.0.3",
|
32 |
+
"@radix-ui/react-toast": "1.1.4",
|
33 |
+
"@radix-ui/react-tooltip": "1.0.6",
|
34 |
+
"@react-pdf/renderer": "3.1.12",
|
35 |
"@types/node": "20.4.2",
|
36 |
"@types/react": "18.2.15",
|
37 |
"@types/react-dom": "18.2.7",
|
38 |
+
"@types/uuid": "9.0.2",
|
39 |
"autoprefixer": "10.4.14",
|
40 |
+
"class-variance-authority": "0.6.1",
|
41 |
+
"clsx": "2.0.0",
|
42 |
+
"cmdk": "0.2.0",
|
43 |
+
"cookies-next": "2.1.2",
|
44 |
+
"date-fns": "2.30.0",
|
45 |
"eslint": "8.45.0",
|
46 |
"eslint-config-next": "13.4.10",
|
47 |
+
"html2canvas": "1.4.1",
|
48 |
+
"lucide-react": "0.260.0",
|
49 |
"next": "13.4.10",
|
50 |
+
"photo-sphere-viewer-lensflare-plugin": "1.1.1",
|
51 |
+
"pick": "0.0.1",
|
52 |
"postcss": "8.4.26",
|
53 |
"react": "18.2.0",
|
54 |
+
"react-circular-progressbar": "2.1.0",
|
55 |
"react-dom": "18.2.0",
|
56 |
+
"react-photo-sphere-viewer": "3.3.5-psv5.1.4",
|
57 |
+
"react-virtualized-auto-sizer": "1.0.20",
|
58 |
+
"sbd": "1.0.19",
|
59 |
+
"sharp": "0.32.5",
|
60 |
+
"styled-components": "6.0.7",
|
61 |
+
"tailwind-merge": "1.13.2",
|
|
|
62 |
"tailwindcss": "3.3.3",
|
63 |
+
"tailwindcss-animate": "1.0.6",
|
64 |
+
"tesseract.js": "4.1.2",
|
65 |
+
"ts-node": "10.9.1",
|
66 |
"typescript": "5.1.6",
|
67 |
+
"usehooks-ts": ".9.1",
|
68 |
+
"uuid": "9.0.0",
|
69 |
+
"zustand": "4.4.1"
|
70 |
},
|
71 |
"devDependencies": {
|
72 |
+
"@types/qs": "6.9.7",
|
73 |
+
"@types/react-virtualized": "9.21.22",
|
74 |
+
"@types/sbd": "1.0.3"
|
75 |
}
|
76 |
}
|
src/app/engine/community.ts
CHANGED
@@ -219,8 +219,8 @@ export async function deletePost({
|
|
219 |
}
|
220 |
|
221 |
if (moderationKey !== secretModerationKey) {
|
222 |
-
console.error(`invalid moderation key, operation denied! please ask a
|
223 |
-
throw new Error(`invalid moderation key, operation denied! please ask a
|
224 |
}
|
225 |
|
226 |
try {
|
|
|
219 |
}
|
220 |
|
221 |
if (moderationKey !== secretModerationKey) {
|
222 |
+
console.error(`invalid moderation key, operation denied! please ask a Text-to-panorama admin for the mdoeration key`)
|
223 |
+
throw new Error(`invalid moderation key, operation denied! please ask a Text-to-panorama admin for the mdoeration key`)
|
224 |
}
|
225 |
|
226 |
try {
|
src/app/engine/render.ts
CHANGED
@@ -1,22 +1,11 @@
|
|
1 |
"use server"
|
2 |
|
3 |
-
import Replicate, { Prediction } from "replicate"
|
4 |
|
5 |
-
import { RenderRequest, RenderedScene
|
6 |
import { generateSeed } from "@/lib/generateSeed"
|
7 |
import { sleep } from "@/lib/sleep"
|
8 |
import { filterOutBadWords } from "./censorship"
|
9 |
|
10 |
-
const renderingEngine = `${process.env.RENDERING_ENGINE || ""}` as RenderingEngine
|
11 |
-
|
12 |
-
const replicateToken = `${process.env.REPLICATE_API_TOKEN || ""}`
|
13 |
-
const replicateModel = `${process.env.REPLICATE_API_MODEL || ""}`
|
14 |
-
const replicateModelVersion = `${process.env.REPLICATE_API_MODEL_VERSION || ""}`
|
15 |
-
|
16 |
-
// note: there is no / at the end in the variable
|
17 |
-
// so we have to add it ourselves if needed
|
18 |
-
const apiUrl = process.env.VIDEOCHAIN_API_URL
|
19 |
-
|
20 |
export async function newRender({
|
21 |
prompt,
|
22 |
clearCache,
|
@@ -49,7 +38,7 @@ export async function newRender({
|
|
49 |
}
|
50 |
|
51 |
try {
|
52 |
-
console.log(`calling
|
53 |
|
54 |
const request = {
|
55 |
prompt,
|
|
|
1 |
"use server"
|
2 |
|
|
|
3 |
|
4 |
+
import { RenderRequest, RenderedScene } from "@/types"
|
5 |
import { generateSeed } from "@/lib/generateSeed"
|
6 |
import { sleep } from "@/lib/sleep"
|
7 |
import { filterOutBadWords } from "./censorship"
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
export async function newRender({
|
10 |
prompt,
|
11 |
clearCache,
|
|
|
38 |
}
|
39 |
|
40 |
try {
|
41 |
+
console.log(`calling Gradio space with prompt: ${prompt}`)
|
42 |
|
43 |
const request = {
|
44 |
prompt,
|
src/app/firehose/page.tsx
CHANGED
@@ -43,7 +43,7 @@ export default function FirehosePage() {
|
|
43 |
)}>
|
44 |
<div className="w-full flex flex-col items-center overflow-y-scroll">
|
45 |
<div className="flex flex-col space-y-2 pt-18 mb-6">
|
46 |
-
<h1 className="text-4xl md:text-6xl lg:text-[70px] xl:text-[100px] text-cyan-700">π
|
47 |
<h2 className="text-3xl mb-6">Generate cool panoramas using AI!</h2>
|
48 |
<h2 className="text-2xl">Latest locations synthesized:</h2>
|
49 |
</div>
|
|
|
43 |
)}>
|
44 |
<div className="w-full flex flex-col items-center overflow-y-scroll">
|
45 |
<div className="flex flex-col space-y-2 pt-18 mb-6">
|
46 |
+
<h1 className="text-4xl md:text-6xl lg:text-[70px] xl:text-[100px] text-cyan-700">π Text-to-panorama</h1>
|
47 |
<h2 className="text-3xl mb-6">Generate cool panoramas using AI!</h2>
|
48 |
<h2 className="text-2xl">Latest locations synthesized:</h2>
|
49 |
</div>
|
src/app/generate/page.tsx
CHANGED
@@ -19,12 +19,12 @@ export default function GeneratePage() {
|
|
19 |
const [_isPending, startTransition] = useTransition()
|
20 |
const postId = (searchParams.get("postId") as string) || ""
|
21 |
|
22 |
-
const prompt = useStore(
|
23 |
-
const setPrompt = useStore(
|
24 |
-
const setRendered = useStore(
|
25 |
-
const renderedScene = useStore(
|
26 |
-
const isLoading = useStore(
|
27 |
-
const setLoading = useStore(
|
28 |
|
29 |
// keep a ref in sync
|
30 |
const renderedRef = useRef<RenderedScene>()
|
@@ -93,6 +93,9 @@ export default function GeneratePage() {
|
|
93 |
setLoading(false)
|
94 |
} else {
|
95 |
console.log("panorama finished:", newRendered)
|
|
|
|
|
|
|
96 |
try {
|
97 |
await postToCommunity({
|
98 |
prompt,
|
@@ -102,6 +105,7 @@ export default function GeneratePage() {
|
|
102 |
} catch (err) {
|
103 |
console.log("failed to post to community, but it's no big deal")
|
104 |
}
|
|
|
105 |
setRendered(newRendered)
|
106 |
setLoading(false)
|
107 |
}
|
|
|
19 |
const [_isPending, startTransition] = useTransition()
|
20 |
const postId = (searchParams.get("postId") as string) || ""
|
21 |
|
22 |
+
const prompt = useStore(s => s.prompt)
|
23 |
+
const setPrompt = useStore(s => s.setPrompt)
|
24 |
+
const setRendered = useStore(s => s.setRendered)
|
25 |
+
const renderedScene = useStore(s => s.renderedScene)
|
26 |
+
const isLoading = useStore(s => s.isLoading)
|
27 |
+
const setLoading = useStore(s => s.setLoading)
|
28 |
|
29 |
// keep a ref in sync
|
30 |
const renderedRef = useRef<RenderedScene>()
|
|
|
93 |
setLoading(false)
|
94 |
} else {
|
95 |
console.log("panorama finished:", newRendered)
|
96 |
+
/*
|
97 |
+
let's disable the community for now
|
98 |
+
|
99 |
try {
|
100 |
await postToCommunity({
|
101 |
prompt,
|
|
|
105 |
} catch (err) {
|
106 |
console.log("failed to post to community, but it's no big deal")
|
107 |
}
|
108 |
+
*/
|
109 |
setRendered(newRendered)
|
110 |
setLoading(false)
|
111 |
}
|
src/app/interface/about/index.tsx
CHANGED
@@ -15,14 +15,14 @@ export function About() {
|
|
15 |
</DialogTrigger>
|
16 |
<DialogContent className="sm:max-w-[425px]">
|
17 |
<DialogHeader>
|
18 |
-
<DialogTitle>
|
19 |
<DialogDescription className="w-full text-center text-lg font-bold text-stone-800">
|
20 |
-
What is
|
21 |
</DialogDescription>
|
22 |
</DialogHeader>
|
23 |
<div className="grid gap-4 py-4 text-stone-800">
|
24 |
<p className="">
|
25 |
-
|
26 |
</p>
|
27 |
<p>
|
28 |
π The stable diffusion model used to generate the images is <a className="text-stone-600 underline" href="https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0" target="_blank">SDXL 1.0</a>.
|
|
|
15 |
</DialogTrigger>
|
16 |
<DialogContent className="sm:max-w-[425px]">
|
17 |
<DialogHeader>
|
18 |
+
<DialogTitle>Text-to-panorama</DialogTitle>
|
19 |
<DialogDescription className="w-full text-center text-lg font-bold text-stone-800">
|
20 |
+
What is this app?
|
21 |
</DialogDescription>
|
22 |
</DialogHeader>
|
23 |
<div className="grid gap-4 py-4 text-stone-800">
|
24 |
<p className="">
|
25 |
+
Text-to-panorama is a free and open-source application made to generate panoramas.
|
26 |
</p>
|
27 |
<p>
|
28 |
π The stable diffusion model used to generate the images is <a className="text-stone-600 underline" href="https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0" target="_blank">SDXL 1.0</a>.
|
src/app/interface/bottom-bar/index.tsx
CHANGED
@@ -4,9 +4,9 @@ import { cn } from "@/lib/utils"
|
|
4 |
import { About } from "../about"
|
5 |
|
6 |
export function BottomBar() {
|
7 |
-
// const prompt = useStore(
|
8 |
-
// const renderedScene = useStore(
|
9 |
-
// const setRendered = useStore(
|
10 |
|
11 |
const isLoading = false
|
12 |
|
|
|
4 |
import { About } from "../about"
|
5 |
|
6 |
export function BottomBar() {
|
7 |
+
// const prompt = useStore(s => s.prompt)
|
8 |
+
// const renderedScene = useStore(s => s.renderedScene)
|
9 |
+
// const setRendered = useStore(s => s.setRendered)
|
10 |
|
11 |
const isLoading = false
|
12 |
|
src/app/interface/top-menu/index.tsx
CHANGED
@@ -8,13 +8,13 @@ import { Input } from "@/components/ui/input"
|
|
8 |
import { useStore } from "@/app/store"
|
9 |
import { Button } from "@/components/ui/button"
|
10 |
export function TopMenu() {
|
11 |
-
const prompt = useStore(
|
12 |
|
13 |
-
const setPrompt = useStore(
|
14 |
-
const setRendered = useStore(
|
15 |
|
16 |
-
const isLoading = useStore(
|
17 |
-
const setLoading = useStore(
|
18 |
|
19 |
const searchParams = useSearchParams()
|
20 |
|
|
|
8 |
import { useStore } from "@/app/store"
|
9 |
import { Button } from "@/components/ui/button"
|
10 |
export function TopMenu() {
|
11 |
+
const prompt = useStore(s => s.prompt)
|
12 |
|
13 |
+
const setPrompt = useStore(s => s.setPrompt)
|
14 |
+
const setRendered = useStore(s => s.setRendered)
|
15 |
|
16 |
+
const isLoading = useStore(s => s.isLoading)
|
17 |
+
const setLoading = useStore(s => s.setLoading)
|
18 |
|
19 |
const searchParams = useSearchParams()
|
20 |
|
src/app/layout.tsx
CHANGED
@@ -6,7 +6,7 @@ const inter = Inter({ subsets: ['latin'] })
|
|
6 |
|
7 |
export const metadata: Metadata = {
|
8 |
// alternative title: Panomania? Teleportal? Panoportal
|
9 |
-
title: '
|
10 |
description: 'Generate panoramas from text! Powered by Hugging Face π€',
|
11 |
}
|
12 |
|
|
|
6 |
|
7 |
export const metadata: Metadata = {
|
8 |
// alternative title: Panomania? Teleportal? Panoportal
|
9 |
+
title: 'Text-to-panorama: generate panoramas from text! Powered by Hugging Face π€',
|
10 |
description: 'Generate panoramas from text! Powered by Hugging Face π€',
|
11 |
}
|
12 |
|