Jiahuita
commited on
Commit
·
f4e5a43
1
Parent(s):
8b4bf9e
Fix deployment issues
Browse files- __pycache__/pipeline.cpython-39.pyc +0 -0
- config.json +2 -2
- pipeline.py +5 -3
- tokenizer_config.json +0 -3
__pycache__/pipeline.cpython-39.pyc
CHANGED
Binary files a/__pycache__/pipeline.cpython-39.pyc and b/__pycache__/pipeline.cpython-39.pyc differ
|
|
config.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:459b49b28436622ac5c9f6e28171fb7d0acc9498e293876b5778846501c4ab94
|
3 |
+
size 212
|
pipeline.py
CHANGED
@@ -20,7 +20,9 @@ class NewsClassifierPipeline(Pipeline):
|
|
20 |
def _forward(self, inputs):
|
21 |
processed = self.preprocess(inputs)
|
22 |
predictions = self.model.predict(processed)
|
23 |
-
|
|
|
|
|
24 |
|
25 |
-
def postprocess(self,
|
26 |
-
return
|
|
|
20 |
def _forward(self, inputs):
|
21 |
processed = self.preprocess(inputs)
|
22 |
predictions = self.model.predict(processed)
|
23 |
+
label = "foxnews" if predictions[0][0] > 0.5 else "nbc"
|
24 |
+
score = predictions[0][0] if label == "foxnews" else 1 - predictions[0][0]
|
25 |
+
return [{"label": label, "score": float(score)}]
|
26 |
|
27 |
+
def postprocess(self, outputs):
|
28 |
+
return outputs
|
tokenizer_config.json
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:1086840ea0ebc3204daeb3f3fd609fbe7cc022dfcb343b72bffc76308a5c9054
|
3 |
-
size 186
|
|
|
|
|
|
|
|