Spaces:
Runtime error
Runtime error
Commit
·
568df48
1
Parent(s):
a63c878
Update app.py
Browse files
app.py
CHANGED
@@ -38,5 +38,10 @@ def TopicClassification(payload: TextIn):
|
|
38 |
loaded_model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
39 |
|
40 |
nlp = TextClassificationPipeline(model=loaded_model, tokenizer=loaded_tokenizer)
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
return {"result": result}
|
|
|
38 |
loaded_model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
39 |
|
40 |
nlp = TextClassificationPipeline(model=loaded_model, tokenizer=loaded_tokenizer)
|
41 |
+
|
42 |
+
text = re.sub(r'[!@#$(),\n"%^*?\:;~`0-9]', " ", payload.text)
|
43 |
+
text = re.sub(r"[[]]", " ", text)
|
44 |
+
text = text.lower()
|
45 |
+
|
46 |
+
result = nlp(text, truncation=True)
|
47 |
return {"result": result}
|