Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,6 +54,8 @@ def chunk_text_to_window_size_and_predict_proba(input_ids, attention_mask, total
|
|
| 54 |
probabilities = torch.nn.functional.softmax(outputs[0], dim = -1)
|
| 55 |
proba_list.append(probabilities)
|
| 56 |
|
|
|
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
def get_sentiment(tokens):
|
|
@@ -122,6 +124,7 @@ def my_inference_function(sec_txt):
|
|
| 122 |
tokens = tokenizer.encode_plus(txt, add_special_tokens=False)
|
| 123 |
|
| 124 |
input_ids = tokens['input_ids']
|
|
|
|
| 125 |
attention_mask = tokens['attention_mask']
|
| 126 |
|
| 127 |
proba_list = chunk_text_to_window_size_and_predict_proba(input_ids, attention_mask, total_len)
|
|
|
|
| 54 |
probabilities = torch.nn.functional.softmax(outputs[0], dim = -1)
|
| 55 |
proba_list.append(probabilities)
|
| 56 |
|
| 57 |
+
start = end
|
| 58 |
+
|
| 59 |
|
| 60 |
|
| 61 |
def get_sentiment(tokens):
|
|
|
|
| 124 |
tokens = tokenizer.encode_plus(txt, add_special_tokens=False)
|
| 125 |
|
| 126 |
input_ids = tokens['input_ids']
|
| 127 |
+
total_len = len(input_ids)
|
| 128 |
attention_mask = tokens['attention_mask']
|
| 129 |
|
| 130 |
proba_list = chunk_text_to_window_size_and_predict_proba(input_ids, attention_mask, total_len)
|