Commit
·
c15bd6e
1
Parent(s):
29925bb
Change records status based on user feedback
Browse filesHi
@merve
!
This includes user feedback in the record:
- Status: Flagged as correct can be used for retraining directly, the rest need to be reviewed (status=Default)
- Metadata: We store the feedback as metadata so we can filter by "Ambiguous" for example and focus on validating those records.
app.py
CHANGED
|
@@ -19,7 +19,12 @@ examples = [
|
|
| 19 |
["Lütfen yardım Akevler mahallesi Rüzgar sokak Tuncay apartmanı zemin kat Antakya akrabalarım göçük altında #hatay #Afad"]
|
| 20 |
]
|
| 21 |
|
| 22 |
-
def create_record(input_text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Making the prediction
|
| 24 |
predictions = nlp(input_text, aggregation_strategy="first")
|
| 25 |
|
|
@@ -40,6 +45,8 @@ def create_record(input_text):
|
|
| 40 |
tokens=words,
|
| 41 |
prediction=prediction,
|
| 42 |
prediction_agent="deprem-ml/deprem-ner",
|
|
|
|
|
|
|
| 43 |
)
|
| 44 |
print(record)
|
| 45 |
return record
|
|
@@ -59,7 +66,7 @@ class ArgillaLogger(FlaggingCallback):
|
|
| 59 |
) -> int:
|
| 60 |
text = flag_data[0]
|
| 61 |
inference = flag_data[1]
|
| 62 |
-
rg.log(name=self.dataset_name, records=create_record(text))
|
| 63 |
|
| 64 |
|
| 65 |
|
|
|
|
| 19 |
["Lütfen yardım Akevler mahallesi Rüzgar sokak Tuncay apartmanı zemin kat Antakya akrabalarım göçük altında #hatay #Afad"]
|
| 20 |
]
|
| 21 |
|
| 22 |
+
def create_record(input_text, feedback):
|
| 23 |
+
# define the record status based on feedback
|
| 24 |
+
# default means it needs to be reviewed --> "Incorrect" or "Ambiguous"
|
| 25 |
+
# validated means it's correct and has been checked --> "Correct"
|
| 26 |
+
status = "Validated" if feedback == "Correct" else "Default"
|
| 27 |
+
|
| 28 |
# Making the prediction
|
| 29 |
predictions = nlp(input_text, aggregation_strategy="first")
|
| 30 |
|
|
|
|
| 45 |
tokens=words,
|
| 46 |
prediction=prediction,
|
| 47 |
prediction_agent="deprem-ml/deprem-ner",
|
| 48 |
+
status=status,
|
| 49 |
+
metadata={"feedback": feedback}
|
| 50 |
)
|
| 51 |
print(record)
|
| 52 |
return record
|
|
|
|
| 66 |
) -> int:
|
| 67 |
text = flag_data[0]
|
| 68 |
inference = flag_data[1]
|
| 69 |
+
rg.log(name=self.dataset_name, records=create_record(text), flag_option)
|
| 70 |
|
| 71 |
|
| 72 |
|