Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from transformers import (
|
2 |
AutoModelForSequenceClassification, # For text emotion detection model
|
|
|
3 |
pipeline, # For creating inference pipeline
|
4 |
PreTrainedTokenizerFast # For processing text input
|
5 |
)
|
@@ -16,7 +17,7 @@ text_dataDict = {"Time": [], "Emotion": [], "Confidence Score": []}
|
|
16 |
face_dataDict = {"Time": [], "Emotion": [], "Confidence Score": []}
|
17 |
|
18 |
emotionDetectModel = AutoModelForSequenceClassification.from_pretrained("borisn70/bert-43-multilabel-emotion-detection") #to be replaced with my fine-tuned model once it is ready
|
19 |
-
tokenizer =
|
20 |
pipe = pipeline(task="text-classification", model=emotionDetectModel, tokenizer=tokenizer)
|
21 |
|
22 |
localFormat = "%Y-%m-%d %H:%M:%S" #this is how will print the timestamp: year-month-day hour-minutes-seconds (army time)
|
|
|
1 |
from transformers import (
|
2 |
AutoModelForSequenceClassification, # For text emotion detection model
|
3 |
+
AutoTokenizer,
|
4 |
pipeline, # For creating inference pipeline
|
5 |
PreTrainedTokenizerFast # For processing text input
|
6 |
)
|
|
|
17 |
face_dataDict = {"Time": [], "Emotion": [], "Confidence Score": []}
|
18 |
|
19 |
emotionDetectModel = AutoModelForSequenceClassification.from_pretrained("borisn70/bert-43-multilabel-emotion-detection") #to be replaced with my fine-tuned model once it is ready
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained("borisn70/bert-43-multilabel-emotion-detection") #ensure we get correct tokenizer that is compatible with this model by loading it directly from this model
|
21 |
pipe = pipeline(task="text-classification", model=emotionDetectModel, tokenizer=tokenizer)
|
22 |
|
23 |
localFormat = "%Y-%m-%d %H:%M:%S" #this is how will print the timestamp: year-month-day hour-minutes-seconds (army time)
|