Spaces:
Sleeping
Sleeping
Commit
·
dc929b8
1
Parent(s):
9d1cd5c
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
|
|
3 |
from simpletransformers.classification import ClassificationModel
|
4 |
from pythainlp import sent_tokenize
|
5 |
from thai_tokenization import ThaiTokenizer
|
@@ -19,6 +20,7 @@ loaded_model = ClassificationModel(
|
|
19 |
|
20 |
def predict_type(title_input):
|
21 |
title_input = title_input.lower()
|
|
|
22 |
title_input = sent_tokenize(title_input)
|
23 |
title_input = ' '.join(tokenizer.tokenize(' '.join(title_input)))
|
24 |
predictions, raw_outputs = loaded_model.predict([title_input])
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
import re
|
4 |
from simpletransformers.classification import ClassificationModel
|
5 |
from pythainlp import sent_tokenize
|
6 |
from thai_tokenization import ThaiTokenizer
|
|
|
20 |
|
21 |
def predict_type(title_input):
|
22 |
title_input = title_input.lower()
|
23 |
+
title_input = re.sub(r'[-:‘’“”.%/()\[\]]', '', title_input)
|
24 |
title_input = sent_tokenize(title_input)
|
25 |
title_input = ' '.join(tokenizer.tokenize(' '.join(title_input)))
|
26 |
predictions, raw_outputs = loaded_model.predict([title_input])
|