Spaces:
Runtime error
Runtime error
Commit ·
ca9da5c
1
Parent(s): 570b959
fix: Add logging to figure out label mapping
Browse files
app.py
CHANGED
|
@@ -3,6 +3,9 @@ from transformers import DistilBertTokenizer
|
|
| 3 |
from transformers import DistilBertForSequenceClassification
|
| 4 |
from transformers import pipeline
|
| 5 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
MODEL_PATH = "RedmarkerAI/hrw_multi_generous_v1"
|
| 8 |
auth_token = os.environ.get("TOKEN_MODEL")
|
|
@@ -20,6 +23,8 @@ def clf_result(text_input: str) -> str:
|
|
| 20 |
res = "Please enter a sentence with the word `best`"
|
| 21 |
return res
|
| 22 |
model_res = clf(text_input)[0]
|
|
|
|
|
|
|
| 23 |
# label_map = {"LABEL_0": "NOT RISKY", "LABEL_1": "RISKY"}
|
| 24 |
label_map = {
|
| 25 |
"0": "Not Risky",
|
|
|
|
| 3 |
from transformers import DistilBertForSequenceClassification
|
| 4 |
from transformers import pipeline
|
| 5 |
import gradio as gr
|
| 6 |
+
import logging
|
| 7 |
+
|
| 8 |
+
logger = logging.getLogger(__name__)
|
| 9 |
|
| 10 |
MODEL_PATH = "RedmarkerAI/hrw_multi_generous_v1"
|
| 11 |
auth_token = os.environ.get("TOKEN_MODEL")
|
|
|
|
| 23 |
res = "Please enter a sentence with the word `best`"
|
| 24 |
return res
|
| 25 |
model_res = clf(text_input)[0]
|
| 26 |
+
logger.info(f"{model_res = }")
|
| 27 |
+
logger.info(f"{model_res['label'] = }")
|
| 28 |
# label_map = {"LABEL_0": "NOT RISKY", "LABEL_1": "RISKY"}
|
| 29 |
label_map = {
|
| 30 |
"0": "Not Risky",
|