malek-messaoudii
commited on
Commit
·
32ba92c
1
Parent(s):
ad2dc28
Update label.py
Browse files- models/label.py +39 -37
models/label.py
CHANGED
|
@@ -9,8 +9,8 @@ class PredictionRequest(BaseModel):
|
|
| 9 |
model_config = ConfigDict(
|
| 10 |
json_schema_extra={
|
| 11 |
"example": {
|
| 12 |
-
"argument": "
|
| 13 |
-
"key_point": "
|
| 14 |
}
|
| 15 |
}
|
| 16 |
)
|
|
@@ -30,12 +30,12 @@ class PredictionResponse(BaseModel):
|
|
| 30 |
model_config = ConfigDict(
|
| 31 |
json_schema_extra={
|
| 32 |
"example": {
|
| 33 |
-
"prediction":
|
| 34 |
-
"confidence": 0.
|
| 35 |
-
"label": "
|
| 36 |
"probabilities": {
|
| 37 |
-
"non_apparie": 0.
|
| 38 |
-
"apparie": 0.
|
| 39 |
}
|
| 40 |
}
|
| 41 |
}
|
|
@@ -64,14 +64,14 @@ class BatchPredictionRequest(BaseModel):
|
|
| 64 |
"argument": "We need more renewable energy",
|
| 65 |
"key_point": "Solar and wind power are important"
|
| 66 |
},
|
| 67 |
-
{
|
| 68 |
-
"argument": "Education should be free for everyone",
|
| 69 |
-
"key_point": "Cars should be electric"
|
| 70 |
-
},
|
| 71 |
{
|
| 72 |
"argument": "Exercise improves health",
|
| 73 |
"key_point": "Physical activity is good for the body"
|
| 74 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
{
|
| 76 |
"argument": "Reading books helps learning",
|
| 77 |
"key_point": "We should build more parks"
|
|
@@ -94,56 +94,58 @@ class BatchPredictionResponse(BaseModel):
|
|
| 94 |
"example": {
|
| 95 |
"predictions": [
|
| 96 |
{
|
| 97 |
-
"prediction":
|
| 98 |
-
"confidence": 0.
|
| 99 |
-
"label": "
|
| 100 |
"probabilities": {
|
| 101 |
-
"non_apparie": 0.
|
| 102 |
-
"apparie": 0.
|
| 103 |
}
|
| 104 |
},
|
| 105 |
{
|
| 106 |
"prediction": 1,
|
| 107 |
-
"confidence": 0.
|
| 108 |
"label": "apparie",
|
| 109 |
"probabilities": {
|
| 110 |
-
"non_apparie": 0.
|
| 111 |
-
"apparie": 0.
|
| 112 |
}
|
| 113 |
},
|
| 114 |
{
|
| 115 |
-
"prediction":
|
| 116 |
-
"confidence": 0.
|
| 117 |
-
"label": "
|
| 118 |
"probabilities": {
|
| 119 |
-
"non_apparie": 0.
|
| 120 |
-
"apparie": 0.
|
| 121 |
}
|
| 122 |
},
|
| 123 |
{
|
| 124 |
-
"prediction":
|
| 125 |
-
"confidence": 0.
|
| 126 |
-
"label": "
|
| 127 |
"probabilities": {
|
| 128 |
-
"non_apparie": 0.
|
| 129 |
-
"apparie": 0.
|
| 130 |
}
|
| 131 |
},
|
| 132 |
{
|
| 133 |
"prediction": 0,
|
| 134 |
-
"confidence": 0.
|
| 135 |
"label": "non_apparie",
|
| 136 |
"probabilities": {
|
| 137 |
-
"non_apparie": 0.
|
| 138 |
-
"apparie": 0.
|
| 139 |
}
|
| 140 |
}
|
| 141 |
],
|
| 142 |
"total_processed": 5,
|
| 143 |
"summary": {
|
| 144 |
-
"total_apparie":
|
| 145 |
-
"total_non_apparie":
|
| 146 |
-
"average_confidence": 0.
|
|
|
|
|
|
|
| 147 |
}
|
| 148 |
}
|
| 149 |
}
|
|
@@ -165,7 +167,7 @@ class HealthResponse(BaseModel):
|
|
| 165 |
"status": "healthy",
|
| 166 |
"model_loaded": True,
|
| 167 |
"device": "cpu",
|
| 168 |
-
"model_name": "NLP-Debater-Project/
|
| 169 |
"timestamp": "2024-01-01T12:00:00Z"
|
| 170 |
}
|
| 171 |
}
|
|
@@ -183,7 +185,7 @@ class ModelInfoResponse(BaseModel):
|
|
| 183 |
model_config = ConfigDict(
|
| 184 |
json_schema_extra={
|
| 185 |
"example": {
|
| 186 |
-
"model_name": "NLP-Debater-Project/
|
| 187 |
"device": "cpu",
|
| 188 |
"max_length": 256,
|
| 189 |
"num_labels": 2,
|
|
|
|
| 9 |
model_config = ConfigDict(
|
| 10 |
json_schema_extra={
|
| 11 |
"example": {
|
| 12 |
+
"argument": "Students should wear school uniforms",
|
| 13 |
+
"key_point": "School uniforms are good for students"
|
| 14 |
}
|
| 15 |
}
|
| 16 |
)
|
|
|
|
| 30 |
model_config = ConfigDict(
|
| 31 |
json_schema_extra={
|
| 32 |
"example": {
|
| 33 |
+
"prediction": 0,
|
| 34 |
+
"confidence": 0.9992,
|
| 35 |
+
"label": "non_apparie",
|
| 36 |
"probabilities": {
|
| 37 |
+
"non_apparie": 0.9992,
|
| 38 |
+
"apparie": 0.0008
|
| 39 |
}
|
| 40 |
}
|
| 41 |
}
|
|
|
|
| 64 |
"argument": "We need more renewable energy",
|
| 65 |
"key_point": "Solar and wind power are important"
|
| 66 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
{
|
| 68 |
"argument": "Exercise improves health",
|
| 69 |
"key_point": "Physical activity is good for the body"
|
| 70 |
},
|
| 71 |
+
{
|
| 72 |
+
"argument": "Education should be free for everyone",
|
| 73 |
+
"key_point": "Cars should be electric"
|
| 74 |
+
},
|
| 75 |
{
|
| 76 |
"argument": "Reading books helps learning",
|
| 77 |
"key_point": "We should build more parks"
|
|
|
|
| 94 |
"example": {
|
| 95 |
"predictions": [
|
| 96 |
{
|
| 97 |
+
"prediction": 0,
|
| 98 |
+
"confidence": 0.9992,
|
| 99 |
+
"label": "non_apparie",
|
| 100 |
"probabilities": {
|
| 101 |
+
"non_apparie": 0.9992,
|
| 102 |
+
"apparie": 0.0008
|
| 103 |
}
|
| 104 |
},
|
| 105 |
{
|
| 106 |
"prediction": 1,
|
| 107 |
+
"confidence": 0.5279,
|
| 108 |
"label": "apparie",
|
| 109 |
"probabilities": {
|
| 110 |
+
"non_apparie": 0.4721,
|
| 111 |
+
"apparie": 0.5279
|
| 112 |
}
|
| 113 |
},
|
| 114 |
{
|
| 115 |
+
"prediction": 1,
|
| 116 |
+
"confidence": 0.8836,
|
| 117 |
+
"label": "apparie",
|
| 118 |
"probabilities": {
|
| 119 |
+
"non_apparie": 0.1164,
|
| 120 |
+
"apparie": 0.8836
|
| 121 |
}
|
| 122 |
},
|
| 123 |
{
|
| 124 |
+
"prediction": 0,
|
| 125 |
+
"confidence": 0.5157,
|
| 126 |
+
"label": "non_apparie",
|
| 127 |
"probabilities": {
|
| 128 |
+
"non_apparie": 0.5157,
|
| 129 |
+
"apparie": 0.4843
|
| 130 |
}
|
| 131 |
},
|
| 132 |
{
|
| 133 |
"prediction": 0,
|
| 134 |
+
"confidence": 0.9958,
|
| 135 |
"label": "non_apparie",
|
| 136 |
"probabilities": {
|
| 137 |
+
"non_apparie": 0.9958,
|
| 138 |
+
"apparie": 0.0042
|
| 139 |
}
|
| 140 |
}
|
| 141 |
],
|
| 142 |
"total_processed": 5,
|
| 143 |
"summary": {
|
| 144 |
+
"total_apparie": 2,
|
| 145 |
+
"total_non_apparie": 3,
|
| 146 |
+
"average_confidence": 0.7844,
|
| 147 |
+
"successful_predictions": 5,
|
| 148 |
+
"failed_predictions": 0
|
| 149 |
}
|
| 150 |
}
|
| 151 |
}
|
|
|
|
| 167 |
"status": "healthy",
|
| 168 |
"model_loaded": True,
|
| 169 |
"device": "cpu",
|
| 170 |
+
"model_name": "NLP-Debater-Project/distilBert-keypoint-matching",
|
| 171 |
"timestamp": "2024-01-01T12:00:00Z"
|
| 172 |
}
|
| 173 |
}
|
|
|
|
| 185 |
model_config = ConfigDict(
|
| 186 |
json_schema_extra={
|
| 187 |
"example": {
|
| 188 |
+
"model_name": "NLP-Debater-Project/distilBert-keypoint-matching",
|
| 189 |
"device": "cpu",
|
| 190 |
"max_length": 256,
|
| 191 |
"num_labels": 2,
|