grantpitt commited on
Commit
9d986ac
1 Parent(s): 2e9f594

make the pipeline conform to types

Browse files
Files changed (2) hide show
  1. pipeline.py +3 -2
  2. requirements.txt +1 -0
pipeline.py CHANGED
@@ -1,5 +1,6 @@
1
  from typing import Dict, List, Any
2
  import random
 
3
 
4
  class PreTrainedPipeline():
5
  def __init__(self, path=""):
@@ -7,7 +8,7 @@ class PreTrainedPipeline():
7
  # Preload all the elements you are going to need at inference.
8
  # For instance your model, processors, tokenizer that might be needed.
9
  # This function is only called once, so do all the heavy processing I/O here"""
10
- self.x = random.randint(0, 1000)
11
 
12
  def __call__(self, inputs: str) -> List[float]:
13
  """
@@ -18,4 +19,4 @@ class PreTrainedPipeline():
18
  A :obj:`list` of floats: The features computed by the model.
19
  """
20
  # IMPLEMENT_THIS
21
- return self.x, inputs
 
1
  from typing import Dict, List, Any
2
  import random
3
+ import numpy as np
4
 
5
  class PreTrainedPipeline():
6
  def __init__(self, path=""):
 
8
  # Preload all the elements you are going to need at inference.
9
  # For instance your model, processors, tokenizer that might be needed.
10
  # This function is only called once, so do all the heavy processing I/O here"""
11
+ self.x = np.random.random(10)
12
 
13
  def __call__(self, inputs: str) -> List[float]:
14
  """
 
19
  A :obj:`list` of floats: The features computed by the model.
20
  """
21
  # IMPLEMENT_THIS
22
+ return self.x[:len(input)].tolist()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ numpy==1.23.1