Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,10 +12,16 @@ model = AutoModelForSequenceClassification.from_pretrained("nlptown/bert-base-mu
|
|
12 |
|
13 |
# Define prediction function
|
14 |
def predict(texts):
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
inputs = tokenizer(
|
18 |
-
|
19 |
return_tensors="pt",
|
20 |
padding=True,
|
21 |
truncation=True,
|
|
|
12 |
|
13 |
# Define prediction function
|
14 |
def predict(texts):
|
15 |
+
processed_texts = []
|
16 |
+
for text in texts:
|
17 |
+
if isinstance(text, list):
|
18 |
+
processed_text = tokenizer.convert_tokens_to_string(text)
|
19 |
+
else:
|
20 |
+
processed_text = text
|
21 |
+
processed_texts.append(processed_text)
|
22 |
+
|
23 |
inputs = tokenizer(
|
24 |
+
processed_texts,
|
25 |
return_tensors="pt",
|
26 |
padding=True,
|
27 |
truncation=True,
|