Update demo.py
Browse files
demo.py
CHANGED
|
@@ -11,8 +11,7 @@ from tensorflow.keras.models import load_model
|
|
| 11 |
from tensorflow.keras.preprocessing.sequence import pad_sequences
|
| 12 |
import re
|
| 13 |
|
| 14 |
-
|
| 15 |
-
svm_repo_id = "your-username/svm-sentiment-model" # Replace with your actual repo
|
| 16 |
svm_model_path = hf_hub_download(repo_id=svm_repo_id, filename="svm_model.pkl")
|
| 17 |
with open(svm_model_path, "rb") as f:
|
| 18 |
svm_model = pickle.load(f)
|
|
@@ -20,7 +19,6 @@ vectorizer_path = hf_hub_download(repo_id=svm_repo_id, filename="vectorizer.pkl"
|
|
| 20 |
with open(vectorizer_path, "rb") as f:
|
| 21 |
vectorizer = pickle.load(f)
|
| 22 |
|
| 23 |
-
# Load LSTM model and tokenizer
|
| 24 |
lstm_repo_id = "arjahojnik/LSTM-sentiment-model"
|
| 25 |
lstm_model_path = hf_hub_download(repo_id=lstm_repo_id, filename="LSTM_model.h5")
|
| 26 |
lstm_model = load_model(lstm_model_path)
|
|
@@ -28,7 +26,6 @@ lstm_tokenizer_path = hf_hub_download(repo_id=lstm_repo_id, filename="my_tokeniz
|
|
| 28 |
with open(lstm_tokenizer_path, "rb") as f:
|
| 29 |
lstm_tokenizer = pickle.load(f)
|
| 30 |
|
| 31 |
-
# Load BERT model and tokenizer
|
| 32 |
bert_tokenizer = AutoTokenizer.from_pretrained("nlptown/bert-base-multilingual-uncased-sentiment")
|
| 33 |
bert_model = AutoModelForSequenceClassification.from_pretrained("nlptown/bert-base-multilingual-uncased-sentiment")
|
| 34 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
| 11 |
from tensorflow.keras.preprocessing.sequence import pad_sequences
|
| 12 |
import re
|
| 13 |
|
| 14 |
+
svm_repo_id = "HighFive-OPJ/Deep_Learning"
|
|
|
|
| 15 |
svm_model_path = hf_hub_download(repo_id=svm_repo_id, filename="svm_model.pkl")
|
| 16 |
with open(svm_model_path, "rb") as f:
|
| 17 |
svm_model = pickle.load(f)
|
|
|
|
| 19 |
with open(vectorizer_path, "rb") as f:
|
| 20 |
vectorizer = pickle.load(f)
|
| 21 |
|
|
|
|
| 22 |
lstm_repo_id = "arjahojnik/LSTM-sentiment-model"
|
| 23 |
lstm_model_path = hf_hub_download(repo_id=lstm_repo_id, filename="LSTM_model.h5")
|
| 24 |
lstm_model = load_model(lstm_model_path)
|
|
|
|
| 26 |
with open(lstm_tokenizer_path, "rb") as f:
|
| 27 |
lstm_tokenizer = pickle.load(f)
|
| 28 |
|
|
|
|
| 29 |
bert_tokenizer = AutoTokenizer.from_pretrained("nlptown/bert-base-multilingual-uncased-sentiment")
|
| 30 |
bert_model = AutoModelForSequenceClassification.from_pretrained("nlptown/bert-base-multilingual-uncased-sentiment")
|
| 31 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|