Update app.py
Browse files
app.py
CHANGED
@@ -10,14 +10,18 @@ Original file is located at
|
|
10 |
|
11 |
"""Our Application"""
|
12 |
|
13 |
-
from transformers import TFBertForSequenceClassification,AutoTokenizer
|
14 |
|
15 |
import numpy as np
|
16 |
|
17 |
import tensorflow as tf # Apply softmax using tf.nn.softmax
|
18 |
|
19 |
# Load the fine-tuned model from the saved directory
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
loaded_tokenizer=AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
|
22 |
|
23 |
def predict_emotion(text):
|
|
|
10 |
|
11 |
"""Our Application"""
|
12 |
|
|
|
13 |
|
14 |
import numpy as np
|
15 |
|
16 |
import tensorflow as tf # Apply softmax using tf.nn.softmax
|
17 |
|
18 |
# Load the fine-tuned model from the saved directory
|
19 |
+
# Load model directly
|
20 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
21 |
+
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained("dhruvsaxena11/emoton_model_dhruv")
|
23 |
+
loaded_model = AutoModelForSequenceClassification.from_pretrained("dhruvsaxena11/emoton_model_dhruv")
|
24 |
+
# loaded_model = TFBertForSequenceClassification.from_pretrained("https://huggingface.co/spaces/dhruvsaxena11/Emotion_Recognition_in_Text/blob/main/tf_model.h5")
|
25 |
loaded_tokenizer=AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
|
26 |
|
27 |
def predict_emotion(text):
|