Spaces:
Sleeping
Sleeping
Update pages/core_risk.py
Browse files- pages/core_risk.py +1 -14
pages/core_risk.py
CHANGED
|
@@ -1,19 +1,12 @@
|
|
| 1 |
import numpy as np
|
| 2 |
-
import torch
|
| 3 |
import transformers
|
| 4 |
import streamlit as st
|
| 5 |
from streamlit import session_state
|
| 6 |
import json
|
| 7 |
-
import torch.nn.functional as F
|
| 8 |
-
import boto3
|
| 9 |
import pandas as pd
|
| 10 |
-
bucket = 'data-ai-dev2'
|
| 11 |
from transformers import BertTokenizer, BertModel
|
| 12 |
from torch import cuda
|
| 13 |
-
device = 'cuda' if cuda.is_available() else 'cpu'
|
| 14 |
import numpy
|
| 15 |
-
from numpy.random import seed
|
| 16 |
-
seed(1)
|
| 17 |
import emoji
|
| 18 |
import string
|
| 19 |
import nltk
|
|
@@ -34,13 +27,7 @@ from transformers import pipeline
|
|
| 34 |
stopwords = nltk.corpus.stopwords.words('english')
|
| 35 |
|
| 36 |
|
| 37 |
-
|
| 38 |
-
tokenizer = 'C:/Users/Meet/Downloads/core_risk/tokenizer/'
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
from transformers import pipeline
|
| 42 |
-
|
| 43 |
-
classifier = pipeline("text-classification", model= model, tokenizer = tokenizer, truncation=True, max_length=512)
|
| 44 |
def pre_processing_str_esg(df_col):
|
| 45 |
df_col = df_col.lower()
|
| 46 |
#defining the function to remove punctuation
|
|
|
|
| 1 |
import numpy as np
|
|
|
|
| 2 |
import transformers
|
| 3 |
import streamlit as st
|
| 4 |
from streamlit import session_state
|
| 5 |
import json
|
|
|
|
|
|
|
| 6 |
import pandas as pd
|
|
|
|
| 7 |
from transformers import BertTokenizer, BertModel
|
| 8 |
from torch import cuda
|
|
|
|
| 9 |
import numpy
|
|
|
|
|
|
|
| 10 |
import emoji
|
| 11 |
import string
|
| 12 |
import nltk
|
|
|
|
| 27 |
stopwords = nltk.corpus.stopwords.words('english')
|
| 28 |
|
| 29 |
|
| 30 |
+
classifier = pipeline("text-classification", model="dsmsb/16class_12k_newtest1618_xlm_roberta_base_27nov_v2_8epoch")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
def pre_processing_str_esg(df_col):
|
| 32 |
df_col = df_col.lower()
|
| 33 |
#defining the function to remove punctuation
|