jbilcke-hf HF staff commited on
Commit
8cd2153
β€’
1 Parent(s): d64b893

easier way to control the number of pages

Browse files
Files changed (4) hide show
  1. .env +1 -0
  2. src/app/interface/login/index.tsx +1 -1
  3. src/app/main.tsx +4 -10
  4. src/config.ts +2 -0
.env CHANGED
@@ -13,6 +13,7 @@ RENDERING_ENGINE="INFERENCE_API"
13
  # - GROQ
14
  LLM_ENGINE="INFERENCE_API"
15
 
 
16
  NEXT_PUBLIC_MAX_NB_PAGES="2"
17
 
18
  # Not implemented for the Inference API yet - you can submit a PR if you have some ideas
 
13
  # - GROQ
14
  LLM_ENGINE="INFERENCE_API"
15
 
16
+ # set this to control the number of pages
17
  NEXT_PUBLIC_MAX_NB_PAGES="2"
18
 
19
  # Not implemented for the Inference API yet - you can submit a PR if you have some ideas
src/app/interface/login/index.tsx CHANGED
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button"
6
  import { useOAuth } from "@/lib/useOAuth"
7
 
8
  export function Login() {
9
- const { canLogin, login, isLoggedIn, oauthResult } = useOAuth({ debug: true })
10
 
11
  useEffect(() => {
12
  if (!oauthResult) {
 
6
  import { useOAuth } from "@/lib/useOAuth"
7
 
8
  export function Login() {
9
+ const { canLogin, login, isLoggedIn, oauthResult } = useOAuth({ debug: false })
10
 
11
  useEffect(() => {
12
  if (!oauthResult) {
src/app/main.tsx CHANGED
@@ -12,6 +12,7 @@ import { Page } from "./interface/page"
12
  import { GeneratedPanel } from "@/types"
13
  import { joinWords } from "@/lib/joinWords"
14
  import { getStoryContinuation } from "./queries/getStoryContinuation"
 
15
 
16
  export default function Main() {
17
  const [_isPending, startTransition] = useTransition()
@@ -68,7 +69,8 @@ export default function Main() {
68
  const newPanelsPrompts: string[] = []
69
  const newCaptions: string[] = []
70
 
71
- const nbPanelsToGenerate = 1
 
72
 
73
  for (
74
  let currentPanel = 0;
@@ -160,15 +162,7 @@ export default function Main() {
160
  style={{
161
  width: `${zoomLevel}%`
162
  }}>
163
- <Page page={0} />
164
-
165
- {/* there are too many people using the AI comic factory right now
166
- so I'm going to disable the second page
167
- */}
168
- {/*
169
- disabled as the comic factory cannot scale right now
170
- <Page page={1} />
171
- */}
172
  </div>
173
  </div>
174
  </div>
 
12
  import { GeneratedPanel } from "@/types"
13
  import { joinWords } from "@/lib/joinWords"
14
  import { getStoryContinuation } from "./queries/getStoryContinuation"
15
+ import { MAX_NB_PAGES, NB_TOTAL_PANELS_TO_GENERATE } from "@/config"
16
 
17
  export default function Main() {
18
  const [_isPending, startTransition] = useTransition()
 
69
  const newPanelsPrompts: string[] = []
70
  const newCaptions: string[] = []
71
 
72
+ // we always generate panels 2 by 2
73
+ const nbPanelsToGenerate = 2
74
 
75
  for (
76
  let currentPanel = 0;
 
162
  style={{
163
  width: `${zoomLevel}%`
164
  }}>
165
+ {Array(MAX_NB_PAGES).fill(0).map((_, i) => <Page key={i} page={i} />)}
 
 
 
 
 
 
 
 
166
  </div>
167
  </div>
168
  </div>
src/config.ts CHANGED
@@ -4,3 +4,5 @@ export const MAX_NB_PAGES = getValidNumber(process.env.NEXT_PUBLIC_MAX_NB_PAGES,
4
 
5
  // TODO: this one should be dynamic and depend upon the page layout type
6
  export const NB_PANELS_PER_PAGE = 4
 
 
 
4
 
5
  // TODO: this one should be dynamic and depend upon the page layout type
6
  export const NB_PANELS_PER_PAGE = 4
7
+
8
+ export const NB_TOTAL_PANELS_TO_GENERATE = MAX_NB_PAGES * NB_PANELS_PER_PAGE