File size: 2,290 Bytes
05fcd0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"""
Base pipeline class for FramePack Studio.
All pipeline implementations should inherit from this class.
"""

import os
from modules.pipelines.metadata_utils import create_metadata

class BasePipeline:
    """Base class for all pipeline implementations."""
    
    def __init__(self, settings):
        """
        Initialize the pipeline with settings.
        
        Args:
            settings: Dictionary of settings for the pipeline
        """
        self.settings = settings
    
    def prepare_parameters(self, job_params):
        """
        Prepare parameters for the job.
        
        Args:
            job_params: Dictionary of job parameters
            
        Returns:
            Processed parameters dictionary
        """
        # Default implementation just returns the parameters as-is
        return job_params
    
    def validate_parameters(self, job_params):
        """
        Validate parameters for the job.
        
        Args:
            job_params: Dictionary of job parameters
            
        Returns:
            Tuple of (is_valid, error_message)
        """
        # Default implementation assumes all parameters are valid
        return True, None
    
    def preprocess_inputs(self, job_params):
        """
        Preprocess input images/videos for the job.
        
        Args:
            job_params: Dictionary of job parameters
            
        Returns:
            Processed inputs dictionary
        """
        # Default implementation returns an empty dictionary
        return {}
    
    def handle_results(self, job_params, result):
        """
        Handle the results of the job.
        
        Args:
            job_params: Dictionary of job parameters
            result: The result of the job
            
        Returns:
            Processed result
        """
        # Default implementation just returns the result as-is
        return result
    
    def create_metadata(self, job_params, job_id):
        """
        Create metadata for the job.
        
        Args:
            job_params: Dictionary of job parameters
            job_id: The job ID
            
        Returns:
            Metadata dictionary
        """
        return create_metadata(job_params, job_id, self.settings)