KeXing
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,10 +14,10 @@ class_model=torch.load('models/class.pt')
|
|
| 14 |
|
| 15 |
def greet(name):
|
| 16 |
|
| 17 |
-
translation_table = str.maketrans("", "", " \t\n\r\f\v")
|
| 18 |
-
name = name.
|
| 19 |
token_ids = torch.tensor([tokenizer.encode(name)])
|
| 20 |
-
|
| 21 |
bert_output = bert_model(token_ids)
|
| 22 |
class_output=class_model(bert_output[1])
|
| 23 |
cluster = torch.argmax(class_output, dim=1) + 1
|
|
|
|
| 14 |
|
| 15 |
def greet(name):
|
| 16 |
|
| 17 |
+
#translation_table = str.maketrans("", "", " \t\n\r\f\v")
|
| 18 |
+
name = name.replace(" ", "").replace("\n", "").replace("\t", "")
|
| 19 |
token_ids = torch.tensor([tokenizer.encode(name)])
|
| 20 |
+
|
| 21 |
bert_output = bert_model(token_ids)
|
| 22 |
class_output=class_model(bert_output[1])
|
| 23 |
cluster = torch.argmax(class_output, dim=1) + 1
|