File size: 633 Bytes
dc2b383
db3682f
d521794
 
db3682f
26d45f0
dc2b383
d521794
86cfb21
dc2b383
d521794
 
dc2b383
26d45f0
86cfb21
d521794
dc2b383
d521794
 
 
1c7044c
1e44872
db3682f
01c8c81
c20b8e7
d521794
 
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
from transformers import Pipeline
from transformers.pipelines import PIPELINE_REGISTRY



class Pipeline_One(Pipeline):
    def _sanitize_parameters(self, **kwargs):
        # Add any additional parameter handling if necessary
        return {}, {}, {}

    def preprocess(self, text, **kwargs):
        return text

    def _forward(self, inputs):
        model_output = self.model.predict(**inputs, k=1)
        return model_output

    def postprocess(self, outputs, **kwargs):
        return outputs
    

# Register the pipeline
PIPELINE_REGISTRY.register_pipeline(
    "language-detection",
    pipeline_class=Pipeline_One,
)