TharinduCD commited on
Commit
c26a6a8
1 Parent(s): 346767e

Delete pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +0 -23
pipeline.py DELETED
@@ -1,23 +0,0 @@
1
- import numpy as np
2
- import typing
3
-
4
- class PreTrainedPipeline():
5
- def __init__(self, path=""):
6
- # Load the FastText model
7
- self.model = fasttext.load_model(path)
8
-
9
- def __call__(self, inputs: str) -> List[List[Dict[str, float]]]:
10
- # Get the predictions from the model
11
- predictions = self.model.predict(inputs)
12
-
13
- # Get the top 5 predictions
14
- top_5_predictions = predictions[:4]
15
-
16
- # Convert the predictions to a list of dictionaries
17
- top_5_predictions_dict = []
18
- for prediction in top_5_predictions:
19
- prediction_dict = {"label": prediction[0], "score": prediction[1]}
20
- top_5_predictions_dict.append(prediction_dict)
21
-
22
- # Return the top 5 predictions
23
- return [top_5_predictions_dict]