Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import json
|
|
| 3 |
import torch
|
| 4 |
import nltk
|
| 5 |
nltk.download("punkt")
|
| 6 |
-
from transformers import
|
| 7 |
from nltk import sent_tokenize
|
| 8 |
import uvicorn
|
| 9 |
from fastapi import FastAPI
|
|
@@ -116,8 +116,8 @@ class AspectSentimentPipeline(Pipeline):
|
|
| 116 |
|
| 117 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 118 |
|
| 119 |
-
aspect_extraction_model =
|
| 120 |
-
aspect_extraction_tokenizer =
|
| 121 |
|
| 122 |
aspect_sentiment_model = BertForSequenceClassification.from_pretrained("thealper2/aspect-sentiment-model")
|
| 123 |
aspect_sentiment_tokenizer = BertTokenizer.from_pretrained("thealper2/aspect-sentiment-tokenizer")
|
|
|
|
| 3 |
import torch
|
| 4 |
import nltk
|
| 5 |
nltk.download("punkt")
|
| 6 |
+
from transformers import ConvBertTokenizerFast, ConvBertForTokenClassification, BertTokenizer, BertForTokenClassification, BertForSequenceClassification, Pipeline
|
| 7 |
from nltk import sent_tokenize
|
| 8 |
import uvicorn
|
| 9 |
from fastapi import FastAPI
|
|
|
|
| 116 |
|
| 117 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 118 |
|
| 119 |
+
aspect_extraction_model = ConvBertForTokenClassification.from_pretrained("thealper2/aspect-extraction-model")
|
| 120 |
+
aspect_extraction_tokenizer = ConvBertTokenizerFast.from_pretrained("thealper2/aspect-extraction-tokenizer")
|
| 121 |
|
| 122 |
aspect_sentiment_model = BertForSequenceClassification.from_pretrained("thealper2/aspect-sentiment-model")
|
| 123 |
aspect_sentiment_tokenizer = BertTokenizer.from_pretrained("thealper2/aspect-sentiment-tokenizer")
|