Spaces:
Runtime error
Runtime error
Peter Moc commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,12 +2,13 @@ import streamlit as st
|
|
| 2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 3 |
import torch
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
| 7 |
|
| 8 |
# Load the model and tokenizer from the Hugging Face Hub
|
| 9 |
-
model = AutoModelForSequenceClassification.from_pretrained(
|
| 10 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 11 |
|
| 12 |
# Function to predict the sentiment
|
| 13 |
def predict_sentiment(text):
|
|
|
|
| 2 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 3 |
import torch
|
| 4 |
|
| 5 |
+
# Paths to the saved model and tokenizer
|
| 6 |
+
model_path = "path_to_save_model"
|
| 7 |
+
tokenizer_path = "path_to_save_tokenizer"
|
| 8 |
|
| 9 |
# Load the model and tokenizer from the Hugging Face Hub
|
| 10 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
| 11 |
+
tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
|
| 12 |
|
| 13 |
# Function to predict the sentiment
|
| 14 |
def predict_sentiment(text):
|