Spaces:
Runtime error
Runtime error
Commit
·
6d205ac
1
Parent(s):
520ccfd
Delete model
Browse files- model/model.py +0 -40
- model/trained_pipeline-0.1.0.pkl +0 -3
model/model.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
import pickle
|
| 2 |
-
import re
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
|
| 5 |
-
__version__ = "0.1.0"
|
| 6 |
-
|
| 7 |
-
BASE_DIR = Path(__file__).resolve(strict=True).parent
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
with open(f"{BASE_DIR}/trained_pipeline-{__version__}.pkl", "rb") as f:
|
| 11 |
-
model = pickle.load(f)
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
classes = [
|
| 15 |
-
"Arabic",
|
| 16 |
-
"Danish",
|
| 17 |
-
"Dutch",
|
| 18 |
-
"English",
|
| 19 |
-
"French",
|
| 20 |
-
"German",
|
| 21 |
-
"Greek",
|
| 22 |
-
"Hindi",
|
| 23 |
-
"Italian",
|
| 24 |
-
"Kannada",
|
| 25 |
-
"Malayalam",
|
| 26 |
-
"Portugeese",
|
| 27 |
-
"Russian",
|
| 28 |
-
"Spanish",
|
| 29 |
-
"Sweedish",
|
| 30 |
-
"Tamil",
|
| 31 |
-
"Turkish",
|
| 32 |
-
]
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
def predict_pipeline(text):
|
| 36 |
-
text = re.sub(r'[!@#$(),\n"%^*?\:;~`0-9]', " ", text)
|
| 37 |
-
text = re.sub(r"[[]]", " ", text)
|
| 38 |
-
text = text.lower()
|
| 39 |
-
pred = model.predict([text])
|
| 40 |
-
return classes[pred[0]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model/trained_pipeline-0.1.0.pkl
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:ab7135c7421b2636cd9fe030d05b883c5ba19ccd13e57195e755a9e43df2bc53
|
| 3 |
-
size 10251835
|
|
|
|
|
|
|
|
|
|
|
|