diff --git a/handler.py b/handler.py
index 753f1df..8aee383 100644
--- a/handler.py
+++ b/handler.py
@@ -341,6 +341,14 @@ def poll_for_completion(prompt_id: str, timeout: int = MAX_TIMEOUT) -> dict:
raise TimeoutError(f"Workflow execution timed out after {timeout}s")
+def get_file_type(filename: str) -> str:
+ """Determine file type from extension."""
+ ext = Path(filename).suffix.lower()
+ if ext in [".mp4", ".webm", ".gif", ".mov", ".avi", ".mkv"]:
+ return "video"
+ return "image"
+
+
def get_output_files(history: dict) -> list:
"""Extract output file info from history."""
outputs = []
@@ -349,12 +357,13 @@ def get_output_files(history: dict) -> list:
return outputs
for node_id, node_output in history["outputs"].items():
- # Handle image outputs
+ # Handle image outputs (note: SaveVideo sometimes puts videos here)
if "images" in node_output:
for img in node_output["images"]:
+ filename = img["filename"]
outputs.append({
- "type": "image",
- "filename": img["filename"],
+ "type": get_file_type(filename),
+ "filename": filename,
"subfolder": img.get("subfolder", ""),
"type_folder": img.get("type", "output")
})
diff --git a/test-runpod.html b/test-runpod.html
index 83ce88a..fbfde91 100644
--- a/test-runpod.html
+++ b/test-runpod.html
@@ -523,32 +523,47 @@
showStatus(`✅ Video generated successfully in ${finalElapsed}s`, 'success');
const outputContainer = document.getElementById('outputContainer');
+ const output = result.output;
- if (result.output.video) {
- // Base64 video
- const videoElem = document.createElement('video');
- videoElem.className = 'output-video';
- videoElem.controls = true;
- videoElem.autoplay = true;
- videoElem.loop = true;
- videoElem.src = 'data:video/mp4;base64,' + result.output.video;
- outputContainer.appendChild(videoElem);
- } else if (result.output.image) {
- // Base64 image
- const imgElem = document.createElement('img');
- imgElem.className = 'output-video';
- imgElem.src = 'data:image/png;base64,' + result.output.image;
- outputContainer.appendChild(imgElem);
- } else if (result.output.file_path) {
- // File path (large output)
- const fileInfo = document.createElement('div');
- fileInfo.className = 'status info show';
- fileInfo.innerHTML = `
- Large output saved to:
- ${result.output.file_path}
- File is too large to display (>10MB). Access it on your RunPod volume.
- `;
- outputContainer.appendChild(fileInfo);
+ // Handler returns: {status, prompt_id, outputs: [{type, filename, data/path, size}]}
+ if (output.outputs && output.outputs.length > 0) {
+ for (const item of output.outputs) {
+ // Determine type from extension (more reliable than type field)
+ const filename = item.filename || '';
+ const isVideo = /\.(mp4|webm|mov|gif|avi|mkv)$/i.test(filename);
+
+ if (isVideo && item.data) {
+ // Base64 video
+ const videoElem = document.createElement('video');
+ videoElem.className = 'output-video';
+ videoElem.controls = true;
+ videoElem.autoplay = true;
+ videoElem.loop = true;
+ videoElem.src = 'data:video/mp4;base64,' + item.data;
+ outputContainer.appendChild(videoElem);
+ } else if (!isVideo && item.data) {
+ // Base64 image
+ const imgElem = document.createElement('img');
+ imgElem.className = 'output-video';
+ imgElem.src = 'data:image/png;base64,' + item.data;
+ outputContainer.appendChild(imgElem);
+ } else if (item.path) {
+ // File path (large output saved to volume)
+ const fileInfo = document.createElement('div');
+ fileInfo.className = 'status info show';
+ fileInfo.innerHTML = `
+ Large output saved to:
+ ${item.path}
+ File: ${item.filename} (${(item.size / 1024 / 1024).toFixed(2)} MB)
+ File is too large to display (>10MB). Access it on your RunPod volume.
+ `;
+ outputContainer.appendChild(fileInfo);
+ }
+ }
+ } else if (output.error) {
+ showStatus('❌ Handler error: ' + output.error, 'error');
+ } else {
+ showStatus('⚠️ No outputs in response', 'error');
}
} else if (result.status === 'FAILED') {
showStatus('❌ Generation failed: ' + (result.error || 'Unknown error'), 'error');
diff --git a/workflows/Wan22-I2V-Remix-API.json b/workflows/Wan22-I2V-Remix-API.json
index 08dbb64..82ef582 100644
--- a/workflows/Wan22-I2V-Remix-API.json
+++ b/workflows/Wan22-I2V-Remix-API.json
@@ -47,7 +47,7 @@
},
"127": {
"inputs": {
- "backend": "inductor",
+ "backend": "disabled",
"fullgraph": false,
"mode": "default",
"dynamic": false,