Spaces:
Sleeping
Sleeping
Muhammad Waqas commited on
Commit ·
c5f9bd0
1
Parent(s): 6bb96e8
Added: Generate image to video
Browse files
app.py
CHANGED
|
@@ -337,10 +337,10 @@ def v1_image_to_video():
|
|
| 337 |
|
| 338 |
# Modify workflow with inputs
|
| 339 |
workflow["30"]["inputs"]["prompt"] = text_prompt
|
|
|
|
| 340 |
workflow["44"]["inputs"]["frame_rate"] = frame_rate
|
| 341 |
workflow["57"]["inputs"]["steps"] = steps
|
| 342 |
workflow["73"]["inputs"]["url"] = image_url
|
| 343 |
-
workflow["31"]["inputs"]["prompt"] = "Low quality, watermark, strange motion, blur"
|
| 344 |
|
| 345 |
# WebSocket connection to queue the prompt
|
| 346 |
ws = websocket.WebSocket()
|
|
@@ -502,10 +502,10 @@ def image_to_video():
|
|
| 502 |
|
| 503 |
# Modify workflow with inputs
|
| 504 |
workflow["30"]["inputs"]["prompt"] = text_prompt
|
|
|
|
| 505 |
workflow["44"]["inputs"]["frame_rate"] = frame_rate
|
| 506 |
workflow["57"]["inputs"]["steps"] = steps
|
| 507 |
workflow["73"]["inputs"]["url"] = image_url
|
| 508 |
-
workflow["31"]["inputs"]["prompt"] = "Low quality, watermark, strange motion"
|
| 509 |
|
| 510 |
# WebSocket connection to queue and monitor workflow
|
| 511 |
ws = websocket.WebSocket()
|
|
@@ -516,8 +516,8 @@ def image_to_video():
|
|
| 516 |
prompt_id = queue_prompt(workflow, token)
|
| 517 |
|
| 518 |
# Wait for workflow execution to complete
|
| 519 |
-
last_ping = time.time()
|
| 520 |
-
PING_INTERVAL = 30
|
| 521 |
|
| 522 |
# Wait for workflow execution to complete
|
| 523 |
while True:
|
|
@@ -527,9 +527,9 @@ def image_to_video():
|
|
| 527 |
break
|
| 528 |
|
| 529 |
# Send a ping if PING_INTERVAL has passed
|
| 530 |
-
if time.time() - last_ping > PING_INTERVAL:
|
| 531 |
-
|
| 532 |
-
|
| 533 |
|
| 534 |
# Fetch the history of the workflow
|
| 535 |
history = get_history(prompt_id, token).get(prompt_id, {})
|
|
|
|
| 337 |
|
| 338 |
# Modify workflow with inputs
|
| 339 |
workflow["30"]["inputs"]["prompt"] = text_prompt
|
| 340 |
+
workflow["31"]["inputs"]["prompt"] = "Low quality, watermark, strange motion, blur"
|
| 341 |
workflow["44"]["inputs"]["frame_rate"] = frame_rate
|
| 342 |
workflow["57"]["inputs"]["steps"] = steps
|
| 343 |
workflow["73"]["inputs"]["url"] = image_url
|
|
|
|
| 344 |
|
| 345 |
# WebSocket connection to queue the prompt
|
| 346 |
ws = websocket.WebSocket()
|
|
|
|
| 502 |
|
| 503 |
# Modify workflow with inputs
|
| 504 |
workflow["30"]["inputs"]["prompt"] = text_prompt
|
| 505 |
+
workflow["31"]["inputs"]["prompt"] = "Low quality, watermark, strange motion, blur"
|
| 506 |
workflow["44"]["inputs"]["frame_rate"] = frame_rate
|
| 507 |
workflow["57"]["inputs"]["steps"] = steps
|
| 508 |
workflow["73"]["inputs"]["url"] = image_url
|
|
|
|
| 509 |
|
| 510 |
# WebSocket connection to queue and monitor workflow
|
| 511 |
ws = websocket.WebSocket()
|
|
|
|
| 516 |
prompt_id = queue_prompt(workflow, token)
|
| 517 |
|
| 518 |
# Wait for workflow execution to complete
|
| 519 |
+
# last_ping = time.time()
|
| 520 |
+
# PING_INTERVAL = 30
|
| 521 |
|
| 522 |
# Wait for workflow execution to complete
|
| 523 |
while True:
|
|
|
|
| 527 |
break
|
| 528 |
|
| 529 |
# Send a ping if PING_INTERVAL has passed
|
| 530 |
+
# if time.time() - last_ping > PING_INTERVAL:
|
| 531 |
+
# ws.send('ping')
|
| 532 |
+
# last_ping = time.time()
|
| 533 |
|
| 534 |
# Fetch the history of the workflow
|
| 535 |
history = get_history(prompt_id, token).get(prompt_id, {})
|