dariadaria commited on
Commit
3702b9d
·
1 Parent(s): 6439837

changed api. dropped list of texts

Browse files
Files changed (1) hide show
  1. handler.py +7 -6
handler.py CHANGED
@@ -28,12 +28,14 @@ class EndpointHandler:
28
  """
29
  data args:
30
  topics List[str]
31
- texts List[Dict[str, str]]: keys shouls be id and text
 
32
  Return:
33
  A :obj:`list` | `dict`: will be serialized and returned
34
  """
35
  topics = data.pop("topics", data)
36
- texts = data.pop("texts", data)
 
37
  batch = {
38
  'id': [],
39
  'text': [],
@@ -41,10 +43,9 @@ class EndpointHandler:
41
  }
42
 
43
  for topic in topics:
44
- for text in texts:
45
- batch['id'].append(text['id'])
46
- batch['text'].append(text['text'])
47
- batch['topic'].append(topic)
48
 
49
  tokenized_inputs = self.tokenize(batch)
50
 
 
28
  """
29
  data args:
30
  topics List[str]
31
+ text str
32
+ id str
33
  Return:
34
  A :obj:`list` | `dict`: will be serialized and returned
35
  """
36
  topics = data.pop("topics", data)
37
+ id = data.pop("id", data)
38
+ text = data.pop("text", data)
39
  batch = {
40
  'id': [],
41
  'text': [],
 
43
  }
44
 
45
  for topic in topics:
46
+ batch['id'].append(id)
47
+ batch['text'].append(text)
48
+ batch['topic'].append(topic)
 
49
 
50
  tokenized_inputs = self.tokenize(batch)
51