webnowa commited on
Commit
0c85c57
·
verified ·
1 Parent(s): b06c794

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  from fastapi import FastAPI, HTTPException
2
  from pydantic import BaseModel
3
- import os, requests, base64, uuid, time, threading
4
 
5
  app = FastAPI()
6
 
@@ -33,8 +33,11 @@ def call_model(url, payload, timeout=60):
33
  raise Exception(resp.text)
34
  data = resp.json()
35
 
 
36
  if isinstance(data, list):
37
  return data[0].get("video")
 
 
38
  return data.get("video")
39
 
40
 
@@ -101,4 +104,3 @@ def status(task_id: str):
101
  if task_id not in TASKS:
102
  raise HTTPException(status_code=404, detail="Task not found")
103
  return TASKS[task_id]
104
-
 
1
  from fastapi import FastAPI, HTTPException
2
  from pydantic import BaseModel
3
+ import os, requests, base64, uuid, threading
4
 
5
  app = FastAPI()
6
 
 
33
  raise Exception(resp.text)
34
  data = resp.json()
35
 
36
+ # TEXT-TO-VIDEO zwraca listę
37
  if isinstance(data, list):
38
  return data[0].get("video")
39
+
40
+ # IMAGE / AVATAR zwracają dict
41
  return data.get("video")
42
 
43
 
 
104
  if task_id not in TASKS:
105
  raise HTTPException(status_code=404, detail="Task not found")
106
  return TASKS[task_id]