File size: 757 Bytes
1cf03f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use server"

import { interpolateGradio } from "./interpolateGradio"
import { interpolateReplicate } from "./interpolateReplicate"

const interpolationEngine = `${process.env.INTERPOLATION_ENGINE || ""}`

export async function interpolateVideo(inputVideo: string): Promise<string> {
  if (!inputVideo?.length) {
    throw new Error(`missing input video`)
  }

  try {

    if (interpolationEngine === "STMFNET_REPLICATE") {
      return interpolateReplicate(inputVideo)
    } else if (interpolationEngine === "FILM_GRADIO") {
      return interpolateGradio(inputVideo)
    } else {
      throw new Error(`unsupported interpolation engine "${interpolationEngine}"`)
    }
  } catch (err) {
    throw new Error(`failed to interpolate the video ${err}`)
  }
}