Spaces:
Running
Running
Update ASG.API/ModelTEC.py
Browse files- ASG.API/ModelTEC.py +26 -1
ASG.API/ModelTEC.py
CHANGED
@@ -19,9 +19,20 @@ from sklearn.metrics import confusion_matrix, classification_report, accuracy_sc
|
|
19 |
|
20 |
from googletrans import Translator
|
21 |
|
22 |
-
|
23 |
import requests
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
class TEC:
|
26 |
__Outs={'svmL':None,'svmK':None,'logstick':None,'target':None}
|
27 |
|
@@ -250,6 +261,20 @@ class TEC:
|
|
250 |
except:
|
251 |
txttec='No'
|
252 |
return txttec
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
def ptedict_proba(self,description,mx=[],is_input=False,istrans=False):
|
255 |
if istrans:
|
|
|
19 |
|
20 |
from googletrans import Translator
|
21 |
|
22 |
+
|
23 |
import requests
|
24 |
|
25 |
+
class ModelPums:
|
26 |
+
def __init__(self):
|
27 |
+
self.obData=None
|
28 |
+
self.obVec=None
|
29 |
+
self.obSVML=None
|
30 |
+
self.obSVMK=None
|
31 |
+
self.oblogict=None
|
32 |
+
self.X=None
|
33 |
+
self.Y=None
|
34 |
+
self.Classes=None
|
35 |
+
|
36 |
class TEC:
|
37 |
__Outs={'svmL':None,'svmK':None,'logstick':None,'target':None}
|
38 |
|
|
|
261 |
except:
|
262 |
txttec='No'
|
263 |
return txttec
|
264 |
+
|
265 |
+
def predict_ids(self,description,is_input=False,istrans=False):
|
266 |
+
if istrans:
|
267 |
+
description=self.to_tran(description)
|
268 |
+
|
269 |
+
# clean_description,_=self.clean_data([(description,' ')],'',is_input=is_input)
|
270 |
+
|
271 |
+
try:
|
272 |
+
features=self.obMP.obVec.transform(description)
|
273 |
+
yp=self.Model.predict(features)
|
274 |
+
# txttec=self.obMP.Classes[yp[0]]
|
275 |
+
except:
|
276 |
+
yp='No'
|
277 |
+
return yp
|
278 |
|
279 |
def ptedict_proba(self,description,mx=[],is_input=False,istrans=False):
|
280 |
if istrans:
|