Spaces:
Sleeping
Sleeping
AndreMitri
commited on
Commit
•
46d3e20
1
Parent(s):
0242ff9
Add 200 token limit to pipeline
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
import pandas as pd
|
3 |
from preprocess_data import preprocess_text,get_stopwords
|
4 |
from datasets import load_dataset
|
5 |
-
from transformers import pipeline
|
6 |
from wordnet import wordnet_pipeline
|
7 |
|
8 |
dataset = load_dataset('danielcd99/imdb')
|
@@ -17,6 +17,9 @@ for split in dataset.keys():
|
|
17 |
MODEL_PATH = 'danielcd99/BERT_imdb'
|
18 |
|
19 |
def load_pipeline():
|
|
|
|
|
|
|
20 |
pipe=pipeline(
|
21 |
"text-classification",
|
22 |
model=MODEL_PATH
|
|
|
2 |
import pandas as pd
|
3 |
from preprocess_data import preprocess_text,get_stopwords
|
4 |
from datasets import load_dataset
|
5 |
+
from transformers import AutoTokenizer, pipeline
|
6 |
from wordnet import wordnet_pipeline
|
7 |
|
8 |
dataset = load_dataset('danielcd99/imdb')
|
|
|
17 |
MODEL_PATH = 'danielcd99/BERT_imdb'
|
18 |
|
19 |
def load_pipeline():
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
|
21 |
+
tokenizer.model_max_length = 200
|
22 |
+
|
23 |
pipe=pipeline(
|
24 |
"text-classification",
|
25 |
model=MODEL_PATH
|