hey I want to make a worker cloudlfare api which generates videos but it got a pretty…
- User
hey I want to make a worker cloudlfare api which generates videos but it got a pretty tough work and I donot want to use a any modules for it it work like it will make a request to https://bytedance-animatediff-lightning.hf.space/queue/join?__theme=dark wit hparams { "data": [ prompt, "ToonYou", "", 4 ], "event_data": null, "fn_index": 1, "trigger_id": 10, "session_hash": sessionHash } where the prompt is get from user and sessionHash
function generateRandomSessionHash() { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; let hash = ''; for (let i = 0; i < 12; i++) { hash += chars[Math.floor(Math.random() * chars.length)]; } return hash; } 2. it will save the sessionHash temp 3. after that it is gonna make a request https://bytedance-animatediff-lightning.hf.space/queue/data?session_hash=sesionHash now the main part comes the thing is when it is gonna request to https://bytedance-animatediff-lightning.hf.space/queue/data?session_hash= it is streaming and gives the data in streaming format here is the streaming data it shows like data: json... example data: {"msg": "estimation", "event_id": "a2d574d0fb6a4a8ca5e34a4591b88ad1", "rank": 0, "queue_size": 1, "rank_eta": 6.608385463103061}
data: {"msg": "process_starts", "event_id": "a2d574d0fb6a4a8ca5e34a4591b88ad1", "eta": 6.608385463103061}
data: {"msg": "progress", "event_id": "a2d574d0fb6a4a8ca5e34a4591b88ad1", "progress_data": [{"index": 0, "length": 4, "unit": "steps", "progress": null, "desc": null}]} ..... data: {"msg": "progress", "event_id": "a2d574d0fb6a4a8ca5e34a4591b88ad1", "progress_data": [{"index": 4, "length": 4, "unit": "steps", "progress": null, "desc": null}]} and
- Assistant