jbilcke-hf HF staff commited on
Commit
5c5e659
1 Parent(s): 8f35fb6
package-lock.json CHANGED
@@ -9634,6 +9634,126 @@
9634
  "optional": true
9635
  }
9636
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9637
  }
9638
  }
9639
  }
 
9634
  "optional": true
9635
  }
9636
  }
9637
+ },
9638
+ "node_modules/@next/swc-darwin-x64": {
9639
+ "version": "13.4.10",
9640
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.10.tgz",
9641
+ "integrity": "sha512-ngXhUBbcZIWZWqNbQSNxQrB9T1V+wgfCzAor2olYuo/YpaL6mUYNUEgeBMhr8qwV0ARSgKaOp35lRvB7EmCRBg==",
9642
+ "cpu": [
9643
+ "x64"
9644
+ ],
9645
+ "optional": true,
9646
+ "os": [
9647
+ "darwin"
9648
+ ],
9649
+ "engines": {
9650
+ "node": ">= 10"
9651
+ }
9652
+ },
9653
+ "node_modules/@next/swc-linux-arm64-gnu": {
9654
+ "version": "13.4.10",
9655
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.10.tgz",
9656
+ "integrity": "sha512-SjCZZCOmHD4uyM75MVArSAmF5Y+IJSGroPRj2v9/jnBT36SYFTORN8Ag/lhw81W9EeexKY/CUg2e9mdebZOwsg==",
9657
+ "cpu": [
9658
+ "arm64"
9659
+ ],
9660
+ "optional": true,
9661
+ "os": [
9662
+ "linux"
9663
+ ],
9664
+ "engines": {
9665
+ "node": ">= 10"
9666
+ }
9667
+ },
9668
+ "node_modules/@next/swc-linux-arm64-musl": {
9669
+ "version": "13.4.10",
9670
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.10.tgz",
9671
+ "integrity": "sha512-F+VlcWijX5qteoYIOxNiBbNE8ruaWuRlcYyIRK10CugqI/BIeCDzEDyrHIHY8AWwbkTwe6GRHabMdE688Rqq4Q==",
9672
+ "cpu": [
9673
+ "arm64"
9674
+ ],
9675
+ "optional": true,
9676
+ "os": [
9677
+ "linux"
9678
+ ],
9679
+ "engines": {
9680
+ "node": ">= 10"
9681
+ }
9682
+ },
9683
+ "node_modules/@next/swc-linux-x64-gnu": {
9684
+ "version": "13.4.10",
9685
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.10.tgz",
9686
+ "integrity": "sha512-WDv1YtAV07nhfy3i1visr5p/tjiH6CeXp4wX78lzP1jI07t4PnHHG1WEDFOduXh3WT4hG6yN82EQBQHDi7hBrQ==",
9687
+ "cpu": [
9688
+ "x64"
9689
+ ],
9690
+ "optional": true,
9691
+ "os": [
9692
+ "linux"
9693
+ ],
9694
+ "engines": {
9695
+ "node": ">= 10"
9696
+ }
9697
+ },
9698
+ "node_modules/@next/swc-linux-x64-musl": {
9699
+ "version": "13.4.10",
9700
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.10.tgz",
9701
+ "integrity": "sha512-zFkzqc737xr6qoBgDa3AwC7jPQzGLjDlkNmt/ljvQJ/Veri5ECdHjZCUuiTUfVjshNIIpki6FuP0RaQYK9iCRg==",
9702
+ "cpu": [
9703
+ "x64"
9704
+ ],
9705
+ "optional": true,
9706
+ "os": [
9707
+ "linux"
9708
+ ],
9709
+ "engines": {
9710
+ "node": ">= 10"
9711
+ }
9712
+ },
9713
+ "node_modules/@next/swc-win32-arm64-msvc": {
9714
+ "version": "13.4.10",
9715
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.10.tgz",
9716
+ "integrity": "sha512-IboRS8IWz5mWfnjAdCekkl8s0B7ijpWeDwK2O8CdgZkoCDY0ZQHBSGiJ2KViAG6+BJVfLvcP+a2fh6cdyBr9QQ==",
9717
+ "cpu": [
9718
+ "arm64"
9719
+ ],
9720
+ "optional": true,
9721
+ "os": [
9722
+ "win32"
9723
+ ],
9724
+ "engines": {
9725
+ "node": ">= 10"
9726
+ }
9727
+ },
9728
+ "node_modules/@next/swc-win32-ia32-msvc": {
9729
+ "version": "13.4.10",
9730
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.10.tgz",
9731
+ "integrity": "sha512-bSA+4j8jY4EEiwD/M2bol4uVEu1lBlgsGdvM+mmBm/BbqofNBfaZ2qwSbwE2OwbAmzNdVJRFRXQZ0dkjopTRaQ==",
9732
+ "cpu": [
9733
+ "ia32"
9734
+ ],
9735
+ "optional": true,
9736
+ "os": [
9737
+ "win32"
9738
+ ],
9739
+ "engines": {
9740
+ "node": ">= 10"
9741
+ }
9742
+ },
9743
+ "node_modules/@next/swc-win32-x64-msvc": {
9744
+ "version": "13.4.10",
9745
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.10.tgz",
9746
+ "integrity": "sha512-g2+tU63yTWmcVQKDGY0MV1PjjqgZtwM4rB1oVVi/v0brdZAcrcTV+04agKzWtvWroyFz6IqtT0MoZJA7PNyLVw==",
9747
+ "cpu": [
9748
+ "x64"
9749
+ ],
9750
+ "optional": true,
9751
+ "os": [
9752
+ "win32"
9753
+ ],
9754
+ "engines": {
9755
+ "node": ">= 10"
9756
+ }
9757
  }
9758
  }
9759
  }
src/app/server/actions/animation.ts CHANGED
@@ -22,35 +22,70 @@ export async function generateAnimation({
22
  }
23
 
24
  try {
25
- // TODO: support other API to avoid duplicate work?
26
- // (are the other API supporting custom LoRAs?)
27
- const res = await fetch(jbilckeApi, {
28
- method: "POST",
29
- headers: {
30
- "Content-Type": "application/json",
31
- // access isn't secured for now, the free lunch is open
32
- // Authorization: `Bearer ${token}`,
33
- },
34
- body: JSON.stringify({
35
- prompt,
36
- lora,
37
- size,
38
- }),
39
- cache: "no-store",
40
- // we can also use this (see https://vercel.com/blog/vercel-cache-api-nextjs-cache)
41
- // next: { revalidate: 1 }
42
- })
43
-
44
- const content = await res.text()
45
-
46
- // Recommendation: handle errors
47
- if (res.status !== 200) {
48
- console.error(content)
49
- // This will activate the closest `error.js` Error Boundary
50
- throw new Error('Failed to fetch data')
51
- }
52
 
53
- return content
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  } catch (err) {
56
  throw new Error(`failed to generate the image ${err}`)
 
22
  }
23
 
24
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ if (videoEngine === "VIDEO_HOTSHOT_XL_API_JBILCKE") {
27
+ // TODO: support other API to avoid duplicate work?
28
+ // (are the other API supporting custom LoRAs?)
29
+ const res = await fetch(jbilckeApi, {
30
+ method: "POST",
31
+ headers: {
32
+ "Content-Type": "application/json",
33
+ // access isn't secured for now, the free lunch is open
34
+ // Authorization: `Bearer ${token}`,
35
+ },
36
+ body: JSON.stringify({
37
+ prompt,
38
+ lora,
39
+ size,
40
+ }),
41
+ cache: "no-store",
42
+ // we can also use this (see https://vercel.com/blog/vercel-cache-api-nextjs-cache)
43
+ // next: { revalidate: 1 }
44
+ })
45
+
46
+ const content = await res.text()
47
+
48
+ // Recommendation: handle errors
49
+ if (res.status !== 200) {
50
+ console.error(content)
51
+ // This will activate the closest `error.js` Error Boundary
52
+ throw new Error('Failed to fetch data')
53
+ }
54
+
55
+ return content
56
+ } else if (videoEngine === "VIDEO_HOTSHOT_XL_API_FFFILONI") {
57
+ const res = await fetch(jbilckeApi, {
58
+ method: "POST",
59
+ headers: {
60
+ "Content-Type": "application/json",
61
+ // access isn't secured for now, the free lunch is open
62
+ // Authorization: `Bearer ${token}`,
63
+ },
64
+ body: JSON.stringify([
65
+ 0,
66
+ prompt,
67
+ // lora, // not supported
68
+ // size,
69
+ ]),
70
+ cache: "no-store",
71
+ // we can also use this (see https://vercel.com/blog/vercel-cache-api-nextjs-cache)
72
+ // next: { revalidate: 1 }
73
+ })
74
+ console.log("res:", res)
75
+
76
+ const content = await res.text()
77
+ console.log("content:", content)
78
+
79
+ // Recommendation: handle errors
80
+ if (res.status !== 200) {
81
+ console.error(content)
82
+ // This will activate the closest `error.js` Error Boundary
83
+ throw new Error('Failed to fetch data')
84
+ }
85
+
86
+ } else {
87
+ throw new Error(`not implemented yet!`)
88
+ }
89
 
90
  } catch (err) {
91
  throw new Error(`failed to generate the image ${err}`)