ddemszky commited on
Commit
8e5414e
1 Parent(s): abd286b

update handler

Browse files
Files changed (3) hide show
  1. __pycache__/handler.cpython-39.pyc +0 -0
  2. handler.py +1 -1
  3. test.py +2 -2
__pycache__/handler.cpython-39.pyc CHANGED
Binary files a/__pycache__/handler.cpython-39.pyc and b/__pycache__/handler.cpython-39.pyc differ
 
handler.py CHANGED
@@ -71,7 +71,7 @@ class EndpointHandler():
71
  with torch.no_grad():
72
  for i, utt in enumerate(utterances):
73
  if utt["speaker"] == params["speaker_2"] and (prev_num_words >= params["speaker_1_min_num_words"]):
74
- uptake_scores[utt["id"]] = self.get_uptake_score(textA=prev_text, textB=utt["text"])
75
  prev_num_words = get_num_words(utt["text"])
76
  prev_text = utt["text"]
77
 
 
71
  with torch.no_grad():
72
  for i, utt in enumerate(utterances):
73
  if utt["speaker"] == params["speaker_2"] and (prev_num_words >= params["speaker_1_min_num_words"]):
74
+ uptake_scores[str(utt["id"])] = self.get_uptake_score(textA=prev_text, textB=utt["text"])
75
  prev_num_words = get_num_words(utt["text"])
76
  prev_text = utt["text"]
77
 
test.py CHANGED
@@ -6,8 +6,8 @@ my_handler = EndpointHandler(path=".")
6
  # prepare sample payload
7
  example = {
8
  "inputs": [
9
- {"id": 1, "speaker": "Alice", "text": "How much is the fish?" },
10
- {"id": 2, "speaker": "Bob", "text": "I have no idea, ask Alice" }
11
  ],
12
  "parameters": {
13
  "speaker_1_min_num_words": 5,
 
6
  # prepare sample payload
7
  example = {
8
  "inputs": [
9
+ {"id": "1", "speaker": "Alice", "text": "How much is the fish?" },
10
+ {"id": "2", "speaker": "Bob", "text": "I have no idea, ask Alice" }
11
  ],
12
  "parameters": {
13
  "speaker_1_min_num_words": 5,