jbilcke-hf HF staff commited on
Commit
5fa1539
·
1 Parent(s): 47d8a80
src/index.mts CHANGED
@@ -102,6 +102,13 @@ app.post("/:ownerId", async (req, res) => {
102
 
103
  console.log(`creating video from request..`)
104
  console.log(`request: `, JSON.stringify(request))
 
 
 
 
 
 
 
105
  try {
106
  video = await parseVideoRequest(ownerId, request)
107
  } catch (err) {
 
102
 
103
  console.log(`creating video from request..`)
104
  console.log(`request: `, JSON.stringify(request))
105
+ if (!request?.prompt?.length) {
106
+ console.error(`failed to create video (prompt is empty})`)
107
+ res.status(400)
108
+ res.write(JSON.stringify({ error: "prompt is empty" }))
109
+ res.end()
110
+ return
111
+ }
112
  try {
113
  video = await parseVideoRequest(ownerId, request)
114
  } catch (err) {
src/utils/getValidResolution.mts CHANGED
@@ -3,8 +3,7 @@ import { getValidNumber } from "./getValidNumber.mts"
3
  export const getValidResolution = (something: any) => {
4
  const strValue = `${something || ''}`
5
  const chunks = strValue.split('x')
6
- console.log("chunks:", chunks)
7
-
8
  if (chunks.length !== 2) {
9
  return `1280x720`
10
  }
 
3
  export const getValidResolution = (something: any) => {
4
  const strValue = `${something || ''}`
5
  const chunks = strValue.split('x')
6
+
 
7
  if (chunks.length !== 2) {
8
  return `1280x720`
9
  }