Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,12 @@ import pandas as pd
|
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
| 6 |
import re
|
| 7 |
-
|
| 8 |
|
| 9 |
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
|
| 10 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification,AdamW
|
| 11 |
-
tokenizer = AutoTokenizer.from_pretrained('hackathon-pln-es/twitter_sexismo-finetuned-exist2021
|
| 12 |
-
model = AutoModelForSequenceClassification.from_pretrained("hackathon-pln-es/twitter_sexismo-finetuned-exist2021
|
| 13 |
|
| 14 |
import torch
|
| 15 |
if torch.cuda.is_available():
|
|
@@ -119,7 +119,8 @@ def run():
|
|
| 119 |
tweet_list = [i.text for i in tweets]
|
| 120 |
#tweet_list = [strip_undesired_chars(i.text) for i in tweets]
|
| 121 |
text= pd.DataFrame(tweet_list)
|
| 122 |
-
text[0] = text[0].apply(preprocess)
|
|
|
|
| 123 |
text1=text[0].values
|
| 124 |
indices1=tokenizer.batch_encode_plus(text1.tolist(),
|
| 125 |
max_length=128,
|
|
|
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
| 6 |
import re
|
| 7 |
+
from pysentimiento.preprocessing import preprocess_tweet
|
| 8 |
|
| 9 |
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
|
| 10 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification,AdamW
|
| 11 |
+
tokenizer = AutoTokenizer.from_pretrained('hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021')
|
| 12 |
+
model = AutoModelForSequenceClassification.from_pretrained("hackathon-pln-es/twitter_sexismo-finetuned-robertuito-exist2021")
|
| 13 |
|
| 14 |
import torch
|
| 15 |
if torch.cuda.is_available():
|
|
|
|
| 119 |
tweet_list = [i.text for i in tweets]
|
| 120 |
#tweet_list = [strip_undesired_chars(i.text) for i in tweets]
|
| 121 |
text= pd.DataFrame(tweet_list)
|
| 122 |
+
#text[0] = text[0].apply(preprocess)
|
| 123 |
+
text[0] = text[0].apply(preprocess_tweet)
|
| 124 |
text1=text[0].values
|
| 125 |
indices1=tokenizer.batch_encode_plus(text1.tolist(),
|
| 126 |
max_length=128,
|