Spaces:
Running
on
A10G
Running
on
A10G
from importlib import import_module | |
from types import ModuleType | |
from typing import Dict, Any | |
from pydantic import BaseModel as PydanticBaseModel, Field | |
def get_pipeline_class(pipeline_name: str) -> ModuleType: | |
try: | |
module = import_module(f"pipelines.{pipeline_name}") | |
except ModuleNotFoundError: | |
raise ValueError(f"Pipeline {pipeline_name} module not found") | |
pipeline_class = getattr(module, "Pipeline", None) | |
if pipeline_class is None: | |
raise ValueError(f"'Pipeline' class not found in module '{pipeline_name}'.") | |
return pipeline_class | |