Spaces:
Runtime error
Runtime error
Commit
·
7fe0ea6
1
Parent(s):
b8a980e
optimized the app
Browse files- .gitignore +3 -1
- app.py +70 -13
- sentiment.py +1 -1
- sentiment_classifier/config.json +0 -34
- sentiment_classifier/special_tokens_map.json +0 -1
- sentiment_classifier/tokenizer.json +0 -0
- sentiment_classifier/tokenizer_config.json +0 -1
- sentiment_classifier/vocab.txt +0 -0
- sentiment_onnx.py +1 -2
- sentiment_onnx_classify.py +69 -11
.gitignore
CHANGED
@@ -1 +1,3 @@
|
|
1 |
-
venv
|
|
|
|
|
|
1 |
+
venv
|
2 |
+
sent_clf_onnx
|
3 |
+
sentiment_model_dir
|
app.py
CHANGED
@@ -3,12 +3,17 @@ import pandas as pd
|
|
3 |
import streamlit as st
|
4 |
from streamlit_text_rating.st_text_rater import st_text_rater
|
5 |
from sentiment import classify_sentiment
|
6 |
-
from sentiment_onnx_classify import classify_sentiment_onnx, classify_sentiment_onnx_quant
|
7 |
from zeroshot_clf import zero_shot_classification
|
|
|
|
|
|
|
|
|
|
|
8 |
import time
|
9 |
import plotly.express as px
|
10 |
import plotly.graph_objects as go
|
11 |
-
|
12 |
global _plotly_config
|
13 |
_plotly_config={'displayModeBar': False}
|
14 |
|
@@ -66,6 +71,18 @@ hide_streamlit_style = """
|
|
66 |
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
67 |
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
st.title("NLP use cases")
|
70 |
|
71 |
with st.sidebar:
|
@@ -77,7 +94,36 @@ with st.sidebar:
|
|
77 |
if select_task=='README':
|
78 |
st.header("NLP Summary")
|
79 |
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
st.header("You are now performing Sentiment Analysis")
|
82 |
input_texts = st.text_input(label="Input texts separated by comma")
|
83 |
c1,c2,c3,c4=st.columns(4)
|
@@ -94,33 +140,44 @@ if select_task=='Detect Sentiment':
|
|
94 |
if any([response1,response2,response3,response4]):
|
95 |
if response1:
|
96 |
start=time.time()
|
97 |
-
sentiments = classify_sentiment(input_texts
|
|
|
|
|
|
|
98 |
end=time.time()
|
99 |
st.write(f"Time taken for computation {(end-start)*1000:.1f} ms")
|
100 |
elif response2:
|
101 |
start = time.time()
|
102 |
-
sentiments=classify_sentiment_onnx(input_texts
|
|
|
|
|
103 |
end = time.time()
|
104 |
st.write(f"Time taken for computation {(end - start) * 1000:.1f} ms")
|
105 |
elif response3:
|
106 |
start = time.time()
|
107 |
-
sentiments=classify_sentiment_onnx_quant(input_texts
|
|
|
|
|
108 |
end = time.time()
|
109 |
st.write(f"Time taken for computation {(end - start) * 1000:.1f} ms")
|
110 |
elif response4:
|
111 |
normal_runtime=[]
|
112 |
for i in range(100):
|
113 |
start=time.time()
|
114 |
-
sentiments = classify_sentiment(input_texts
|
|
|
|
|
115 |
end=time.time()
|
116 |
t = (end - start) * 1000
|
117 |
normal_runtime.append(t)
|
118 |
-
normal_runtime=np.clip(normal_runtime,10,
|
119 |
|
120 |
onnx_runtime=[]
|
121 |
for i in range(100):
|
122 |
start=time.time()
|
123 |
-
sentiments = classify_sentiment_onnx(input_texts
|
|
|
|
|
124 |
end=time.time()
|
125 |
t=(end-start)*1000
|
126 |
onnx_runtime.append(t)
|
@@ -129,12 +186,14 @@ if select_task=='Detect Sentiment':
|
|
129 |
onnx_runtime_quant=[]
|
130 |
for i in range(100):
|
131 |
start=time.time()
|
132 |
-
sentiments = classify_sentiment_onnx_quant(input_texts
|
|
|
|
|
133 |
end=time.time()
|
134 |
|
135 |
t=(end-start)*1000
|
136 |
onnx_runtime_quant.append(t)
|
137 |
-
onnx_runtime_quant = np.clip(onnx_runtime_quant, 0,
|
138 |
|
139 |
|
140 |
temp_df=pd.DataFrame({'Normal Runtime (ms)':normal_runtime,
|
@@ -188,5 +247,3 @@ if select_task=='Zero Shot Classification':
|
|
188 |
st.write(f"Time taken for computation {(end-start)*1000:.1f} ms")
|
189 |
st.plotly_chart(output, config=_plotly_config)
|
190 |
|
191 |
-
|
192 |
-
#awesome
|
|
|
3 |
import streamlit as st
|
4 |
from streamlit_text_rating.st_text_rater import st_text_rater
|
5 |
from sentiment import classify_sentiment
|
6 |
+
from sentiment_onnx_classify import classify_sentiment_onnx, classify_sentiment_onnx_quant,create_onnx_model
|
7 |
from zeroshot_clf import zero_shot_classification
|
8 |
+
from transformers import AutoTokenizer,AutoModelForSequenceClassification
|
9 |
+
from onnxruntime.quantization import quantize_dynamic,QuantType
|
10 |
+
import transformers.convert_graph_to_onnx as onnx_convert
|
11 |
+
from pathlib import Path
|
12 |
+
import os
|
13 |
import time
|
14 |
import plotly.express as px
|
15 |
import plotly.graph_objects as go
|
16 |
+
import onnxruntime as ort
|
17 |
global _plotly_config
|
18 |
_plotly_config={'displayModeBar': False}
|
19 |
|
|
|
71 |
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
72 |
|
73 |
|
74 |
+
@st.cache(allow_output_mutation=True, suppress_st_warning=True, max_entries=None, ttl=None)
|
75 |
+
def create_model_dir(chkpt, model_dir):
|
76 |
+
if not os.path.exists(chkpt):
|
77 |
+
os.mkdir(model_dir)
|
78 |
+
_model = AutoModelForSequenceClassification.from_pretrained(chkpt)
|
79 |
+
_tokenizer = AutoTokenizer.from_pretrained(chkpt)
|
80 |
+
_model.save_pretrained(model_dir)
|
81 |
+
_tokenizer.save_pretrained(model_dir)
|
82 |
+
else:
|
83 |
+
pass
|
84 |
+
|
85 |
+
|
86 |
st.title("NLP use cases")
|
87 |
|
88 |
with st.sidebar:
|
|
|
94 |
if select_task=='README':
|
95 |
st.header("NLP Summary")
|
96 |
|
97 |
+
############### Pre-Download & instantiate objects for sentiment analysis *********************** START **********************
|
98 |
+
sent_chkpt = 'distilbert-base-uncased-finetuned-sst-2-english'
|
99 |
+
sent_model_dir='sentiment_model_dir'
|
100 |
+
#create model/token dir
|
101 |
+
create_model_dir(chkpt=sent_chkpt, model_dir=sent_model_dir)
|
102 |
+
|
103 |
+
@st.cache(allow_output_mutation=True, suppress_st_warning=True, max_entries=None, ttl=None)
|
104 |
+
def task_selected(task,sent_model_dir=sent_model_dir):
|
105 |
+
model_sentiment=AutoModelForSequenceClassification.from_pretrained(sent_model_dir)
|
106 |
+
tokenizer_sentiment=AutoTokenizer.from_pretrained(sent_model_dir)
|
107 |
+
|
108 |
+
create_onnx_model(_model=model_sentiment, _tokenizer=tokenizer_sentiment)
|
109 |
+
|
110 |
+
#create inference session
|
111 |
+
sentiment_session = ort.InferenceSession("sent_clf_onnx/sentiment_classifier_onnx.onnx")
|
112 |
+
sentiment_session_int8 = ort.InferenceSession("sent_clf_onnx/sentiment_classifier_onnx_int8.onnx")
|
113 |
+
|
114 |
+
return model_sentiment,tokenizer_sentiment,sentiment_session,sentiment_session_int8
|
115 |
+
|
116 |
+
|
117 |
+
############## Pre-Download & instantiate objects for sentiment analysis ********************* END **********************************
|
118 |
+
|
119 |
+
if select_task == 'Detect Sentiment':
|
120 |
+
|
121 |
+
t1=time.time()
|
122 |
+
model_sentiment,tokenizer_sentiment,\
|
123 |
+
sentiment_session,sentiment_session_int8 = task_selected(task=select_task)
|
124 |
+
t2 = time.time()
|
125 |
+
st.write(f"Total time to load Model is {(t2-t1)*1000:.1f} ms")
|
126 |
+
|
127 |
st.header("You are now performing Sentiment Analysis")
|
128 |
input_texts = st.text_input(label="Input texts separated by comma")
|
129 |
c1,c2,c3,c4=st.columns(4)
|
|
|
140 |
if any([response1,response2,response3,response4]):
|
141 |
if response1:
|
142 |
start=time.time()
|
143 |
+
sentiments = classify_sentiment(input_texts,
|
144 |
+
model=model_sentiment,
|
145 |
+
tokenizer=tokenizer_sentiment
|
146 |
+
)
|
147 |
end=time.time()
|
148 |
st.write(f"Time taken for computation {(end-start)*1000:.1f} ms")
|
149 |
elif response2:
|
150 |
start = time.time()
|
151 |
+
sentiments=classify_sentiment_onnx(input_texts,
|
152 |
+
_session=sentiment_session,
|
153 |
+
_tokenizer=tokenizer_sentiment)
|
154 |
end = time.time()
|
155 |
st.write(f"Time taken for computation {(end - start) * 1000:.1f} ms")
|
156 |
elif response3:
|
157 |
start = time.time()
|
158 |
+
sentiments=classify_sentiment_onnx_quant(input_texts,
|
159 |
+
_session=sentiment_session_int8,
|
160 |
+
_tokenizer=tokenizer_sentiment)
|
161 |
end = time.time()
|
162 |
st.write(f"Time taken for computation {(end - start) * 1000:.1f} ms")
|
163 |
elif response4:
|
164 |
normal_runtime=[]
|
165 |
for i in range(100):
|
166 |
start=time.time()
|
167 |
+
sentiments = classify_sentiment(input_texts,
|
168 |
+
model=model_sentiment,
|
169 |
+
tokenizer=tokenizer_sentiment)
|
170 |
end=time.time()
|
171 |
t = (end - start) * 1000
|
172 |
normal_runtime.append(t)
|
173 |
+
normal_runtime=np.clip(normal_runtime,10,60)
|
174 |
|
175 |
onnx_runtime=[]
|
176 |
for i in range(100):
|
177 |
start=time.time()
|
178 |
+
sentiments = classify_sentiment_onnx(input_texts,
|
179 |
+
_session=sentiment_session,
|
180 |
+
_tokenizer=tokenizer_sentiment)
|
181 |
end=time.time()
|
182 |
t=(end-start)*1000
|
183 |
onnx_runtime.append(t)
|
|
|
186 |
onnx_runtime_quant=[]
|
187 |
for i in range(100):
|
188 |
start=time.time()
|
189 |
+
sentiments = classify_sentiment_onnx_quant(input_texts,
|
190 |
+
_session=sentiment_session,
|
191 |
+
_tokenizer=tokenizer_sentiment)
|
192 |
end=time.time()
|
193 |
|
194 |
t=(end-start)*1000
|
195 |
onnx_runtime_quant.append(t)
|
196 |
+
onnx_runtime_quant = np.clip(onnx_runtime_quant, 0, 20)
|
197 |
|
198 |
|
199 |
temp_df=pd.DataFrame({'Normal Runtime (ms)':normal_runtime,
|
|
|
247 |
st.write(f"Time taken for computation {(end-start)*1000:.1f} ms")
|
248 |
st.plotly_chart(output, config=_plotly_config)
|
249 |
|
|
|
|
sentiment.py
CHANGED
@@ -6,7 +6,7 @@ model=AutoModelForSequenceClassification.from_pretrained(chkpt)
|
|
6 |
tokenizer=AutoTokenizer.from_pretrained(chkpt)
|
7 |
# tokenizer=AutoTokenizer.from_pretrained('sentiment_classifier/')
|
8 |
|
9 |
-
def classify_sentiment(texts,model
|
10 |
"""
|
11 |
user will pass texts separated by comma
|
12 |
"""
|
|
|
6 |
tokenizer=AutoTokenizer.from_pretrained(chkpt)
|
7 |
# tokenizer=AutoTokenizer.from_pretrained('sentiment_classifier/')
|
8 |
|
9 |
+
def classify_sentiment(texts,model,tokenizer):
|
10 |
"""
|
11 |
user will pass texts separated by comma
|
12 |
"""
|
sentiment_classifier/config.json
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_name_or_path": "distilbert-base-uncased-finetuned-sst-2-english",
|
3 |
-
"activation": "gelu",
|
4 |
-
"architectures": [
|
5 |
-
"DistilBertForSequenceClassification"
|
6 |
-
],
|
7 |
-
"attention_dropout": 0.1,
|
8 |
-
"dim": 768,
|
9 |
-
"dropout": 0.1,
|
10 |
-
"finetuning_task": "sst-2",
|
11 |
-
"hidden_dim": 3072,
|
12 |
-
"id2label": {
|
13 |
-
"0": "NEGATIVE",
|
14 |
-
"1": "POSITIVE"
|
15 |
-
},
|
16 |
-
"initializer_range": 0.02,
|
17 |
-
"label2id": {
|
18 |
-
"NEGATIVE": 0,
|
19 |
-
"POSITIVE": 1
|
20 |
-
},
|
21 |
-
"max_position_embeddings": 512,
|
22 |
-
"model_type": "distilbert",
|
23 |
-
"n_heads": 12,
|
24 |
-
"n_layers": 6,
|
25 |
-
"output_past": true,
|
26 |
-
"pad_token_id": 0,
|
27 |
-
"qa_dropout": 0.1,
|
28 |
-
"seq_classif_dropout": 0.2,
|
29 |
-
"sinusoidal_pos_embds": false,
|
30 |
-
"tie_weights_": true,
|
31 |
-
"torch_dtype": "float32",
|
32 |
-
"transformers_version": "4.18.0",
|
33 |
-
"vocab_size": 30522
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sentiment_classifier/special_tokens_map.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
|
|
|
sentiment_classifier/tokenizer.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
sentiment_classifier/tokenizer_config.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "distilbert-base-uncased-finetuned-sst-2-english", "do_basic_tokenize": true, "never_split": null, "tokenizer_class": "DistilBertTokenizer"}
|
|
|
|
sentiment_classifier/vocab.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
sentiment_onnx.py
CHANGED
@@ -12,8 +12,7 @@ python3 -m transformers.onnx --model= distilbert-base-uncased-finetuned-sst-2-en
|
|
12 |
"""
|
13 |
chkpt='distilbert-base-uncased-finetuned-sst-2-english'
|
14 |
model= AutoModelForSequenceClassification.from_pretrained(chkpt)
|
15 |
-
tokenizer= AutoTokenizer.from_pretrained(
|
16 |
-
# tokenizer= AutoTokenizer.from_pretrained('sentiment_classifier/')
|
17 |
|
18 |
"""
|
19 |
or download the model directly from hub --
|
|
|
12 |
"""
|
13 |
chkpt='distilbert-base-uncased-finetuned-sst-2-english'
|
14 |
model= AutoModelForSequenceClassification.from_pretrained(chkpt)
|
15 |
+
tokenizer= AutoTokenizer.from_pretrained(chkpt)
|
|
|
16 |
|
17 |
"""
|
18 |
or download the model directly from hub --
|
sentiment_onnx_classify.py
CHANGED
@@ -1,23 +1,74 @@
|
|
1 |
import onnxruntime as ort
|
2 |
import torch
|
3 |
-
from transformers import AutoTokenizer
|
4 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
chkpt='distilbert-base-uncased-finetuned-sst-2-english'
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
#create onnx & onnx_int_8 sessions
|
11 |
-
session=ort.InferenceSession("sent_clf_onnx/sentiment_classifier_onnx.onnx")
|
12 |
-
session_int8=ort.InferenceSession("sent_clf_onnx/sentiment_classifier_onnx_int8.onnx")
|
13 |
|
14 |
# options=ort.SessionOptions()
|
15 |
# options.inter_op_num_threads=1
|
16 |
# options.intra_op_num_threads=1
|
17 |
|
18 |
-
def classify_sentiment_onnx(texts,
|
19 |
"""
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
"""
|
22 |
try:
|
23 |
texts=texts.split(',')
|
@@ -32,15 +83,22 @@ def classify_sentiment_onnx(texts,_model=session,_tokenizer=tokenizer):
|
|
32 |
"attention_mask":np.array((_inputs['attention_mask']))
|
33 |
}
|
34 |
|
35 |
-
output =
|
36 |
|
37 |
output=np.argmax(output,axis=1)
|
38 |
output = ['Positive' if i == 1 else 'Negative' for i in output]
|
39 |
return output
|
40 |
|
41 |
-
def classify_sentiment_onnx_quant(texts,
|
42 |
"""
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
"""
|
45 |
try:
|
46 |
texts=texts.split(',')
|
@@ -56,7 +114,7 @@ def classify_sentiment_onnx_quant(texts, _model=session_int8, _tokenizer=tokeniz
|
|
56 |
"attention_mask":np.array((_inputs['attention_mask']))
|
57 |
}
|
58 |
|
59 |
-
output =
|
60 |
|
61 |
output=np.argmax(output,axis=1)
|
62 |
output = ['Positive' if i == 1 else 'Negative' for i in output]
|
|
|
1 |
import onnxruntime as ort
|
2 |
import torch
|
3 |
+
from transformers import AutoTokenizer,AutoModelForSequenceClassification
|
4 |
import numpy as np
|
5 |
+
import transformers
|
6 |
+
from onnxruntime.quantization import quantize_dynamic,QuantType
|
7 |
+
import transformers.convert_graph_to_onnx as onnx_convert
|
8 |
+
from pathlib import Path
|
9 |
+
import os
|
10 |
|
11 |
chkpt='distilbert-base-uncased-finetuned-sst-2-english'
|
12 |
+
model= AutoModelForSequenceClassification.from_pretrained(chkpt)
|
13 |
+
tokenizer= AutoTokenizer.from_pretrained(chkpt)
|
14 |
+
|
15 |
+
def create_onnx_model(_model, _tokenizer):
|
16 |
+
"""
|
17 |
+
|
18 |
+
Args:
|
19 |
+
_model: model checkpoint with AutoModelForSequenceClassification
|
20 |
+
_tokenizer: model checkpoint with AutoTokenizer
|
21 |
+
|
22 |
+
Returns:
|
23 |
+
Creates a simple ONNX model & int8 Quantized Model in the directory "sent_clf_onnx/" if directory not present
|
24 |
+
|
25 |
+
"""
|
26 |
+
if not os.path.exists('sent_clf_onnx'):
|
27 |
+
os.mkdir('sent_clf_onnx')
|
28 |
+
"""
|
29 |
+
Making ONNX model object
|
30 |
+
"""
|
31 |
+
pipeline=transformers.pipeline("text-classification", model=_model, tokenizer=_tokenizer)
|
32 |
+
|
33 |
+
"""
|
34 |
+
convert pipeline to onnx object
|
35 |
+
"""
|
36 |
+
onnx_convert.convert_pytorch(pipeline,
|
37 |
+
opset=11,
|
38 |
+
output=Path("sent_clf_onnx/sentiment_classifier_onnx.onnx"),
|
39 |
+
use_external_format=False
|
40 |
+
)
|
41 |
+
|
42 |
+
"""
|
43 |
+
convert onnx object to another onnx object with int8 quantization
|
44 |
+
"""
|
45 |
+
quantize_dynamic("sent_clf_onnx/sentiment_classifier_onnx.onnx","sent_clf_onnx/sentiment_classifier_onnx_int8.onnx",
|
46 |
+
weight_type=QuantType.QUInt8)
|
47 |
+
else:
|
48 |
+
pass
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
|
53 |
#create onnx & onnx_int_8 sessions
|
54 |
+
session = ort.InferenceSession("sent_clf_onnx/sentiment_classifier_onnx.onnx")
|
55 |
+
session_int8 = ort.InferenceSession("sent_clf_onnx/sentiment_classifier_onnx_int8.onnx")
|
56 |
|
57 |
# options=ort.SessionOptions()
|
58 |
# options.inter_op_num_threads=1
|
59 |
# options.intra_op_num_threads=1
|
60 |
|
61 |
+
def classify_sentiment_onnx(texts, _session, _tokenizer):
|
62 |
"""
|
63 |
+
|
64 |
+
Args:
|
65 |
+
texts: input texts from user
|
66 |
+
_session: pass ONNX runtime session
|
67 |
+
_tokenizer: Relevant Tokenizer e.g. AutoTokenizer.from_pretrained("same checkpoint as the model")
|
68 |
+
|
69 |
+
Returns:
|
70 |
+
list of Positve and Negative texts
|
71 |
+
|
72 |
"""
|
73 |
try:
|
74 |
texts=texts.split(',')
|
|
|
83 |
"attention_mask":np.array((_inputs['attention_mask']))
|
84 |
}
|
85 |
|
86 |
+
output = _session.run(input_feed=input_feed, output_names=['output_0'])[0]
|
87 |
|
88 |
output=np.argmax(output,axis=1)
|
89 |
output = ['Positive' if i == 1 else 'Negative' for i in output]
|
90 |
return output
|
91 |
|
92 |
+
def classify_sentiment_onnx_quant(texts, _session, _tokenizer):
|
93 |
"""
|
94 |
+
Args:
|
95 |
+
texts: input texts from user
|
96 |
+
_session: pass ONNX runtime session
|
97 |
+
_tokenizer: Relevant Tokenizer e.g. AutoTokenizer.from_pretrained("same checkpoint as the model")
|
98 |
+
|
99 |
+
Returns:
|
100 |
+
list of Positve and Negative texts
|
101 |
+
|
102 |
"""
|
103 |
try:
|
104 |
texts=texts.split(',')
|
|
|
114 |
"attention_mask":np.array((_inputs['attention_mask']))
|
115 |
}
|
116 |
|
117 |
+
output = _session.run(input_feed=input_feed, output_names=['output_0'])[0]
|
118 |
|
119 |
output=np.argmax(output,axis=1)
|
120 |
output = ['Positive' if i == 1 else 'Negative' for i in output]
|