Update app.py
Browse files
app.py
CHANGED
@@ -98,9 +98,7 @@ def load_models():
|
|
98 |
tokenizer = AutoTokenizer.from_pretrained('gpt2-large')
|
99 |
model = GPT2LMHeadModel.from_pretrained('gpt2-large')
|
100 |
return tokenizer, model
|
101 |
-
|
102 |
-
tokenizer = AutoTokenizer.from_pretrained('t5-base')
|
103 |
-
model = AutoModelWithLMHead.from_pretrained('t5-base', return_dict=True)
|
104 |
# Function For Extracting Entities
|
105 |
@st.experimental_singleton
|
106 |
#@st.cache_resource(experimental_allow_widgets=True)
|
@@ -112,6 +110,9 @@ def entity_analyzer(my_text):
|
|
112 |
allData = ['"Token":{},\n"Entities":{}'.format(tokens,entities)]
|
113 |
return allData
|
114 |
def main():
|
|
|
|
|
|
|
115 |
""" NLP Based Application with Streamlit """
|
116 |
st.markdown("""
|
117 |
#### Description
|
|
|
98 |
tokenizer = AutoTokenizer.from_pretrained('gpt2-large')
|
99 |
model = GPT2LMHeadModel.from_pretrained('gpt2-large')
|
100 |
return tokenizer, model
|
101 |
+
|
|
|
|
|
102 |
# Function For Extracting Entities
|
103 |
@st.experimental_singleton
|
104 |
#@st.cache_resource(experimental_allow_widgets=True)
|
|
|
110 |
allData = ['"Token":{},\n"Entities":{}'.format(tokens,entities)]
|
111 |
return allData
|
112 |
def main():
|
113 |
+
global tokenizer, model
|
114 |
+
tokenizer = AutoTokenizer.from_pretrained('t5-base')
|
115 |
+
model = AutoModelWithLMHead.from_pretrained('t5-base', return_dict=True)
|
116 |
""" NLP Based Application with Streamlit """
|
117 |
st.markdown("""
|
118 |
#### Description
|