ashhadahsan commited on
Commit
7d73e2a
·
1 Parent(s): 5e99f3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -10,10 +10,7 @@ from tensorflow.nn import softmax
10
  import numpy as np
11
  from datetime import datetime
12
  import logging
13
- import pip
14
-
15
-
16
- import gc
17
 
18
  date = datetime.now().strftime(r"%Y-%m-%d")
19
  model_classes = {
@@ -171,7 +168,7 @@ if st.button("Process", type="primary"):
171
  for x in stqdm(range(len(text))):
172
  tf_o = softmax(tf_outputs["logits"][x], axis=-1)
173
  label = np.argmax(tf_o, axis=0)
174
- keys = model_classes
175
  classes.append(keys.get(label))
176
  output["sub theme"] = classes
177
  del classification_token, classification_model
@@ -248,7 +245,7 @@ if st.button("Process", type="primary"):
248
  for x in stqdm(range(len(text))):
249
  tf_o = softmax(tf_outputs["logits"][x], axis=-1)
250
  label = np.argmax(tf_o, axis=0)
251
- keys = model_classes
252
  classes.append(keys.get(label))
253
  output["sub theme"] = classes
254
  del classification_token, classification_model
@@ -296,7 +293,7 @@ if st.button("Process", type="primary"):
296
  keys = model_classes
297
  classes.append(keys.get(label))
298
  output["category"] = classes
299
- del classification_token,classification_model
300
  if sub_theme:
301
  classification_token, classification_model = classify_sub_theme()
302
  tf_batch = classification_token(
@@ -313,7 +310,7 @@ if st.button("Process", type="primary"):
313
  for x in stqdm(range(len(text))):
314
  tf_o = softmax(tf_outputs["logits"][x], axis=-1)
315
  label = np.argmax(tf_o, axis=0)
316
- keys = model_classes
317
  classes.append(keys.get(label))
318
  output["sub theme"] = classes
319
  del classification_token, classification_model
 
10
  import numpy as np
11
  from datetime import datetime
12
  import logging
13
+ from constants import sub_themes_dict
 
 
 
14
 
15
  date = datetime.now().strftime(r"%Y-%m-%d")
16
  model_classes = {
 
168
  for x in stqdm(range(len(text))):
169
  tf_o = softmax(tf_outputs["logits"][x], axis=-1)
170
  label = np.argmax(tf_o, axis=0)
171
+ keys = sub_themes_dict
172
  classes.append(keys.get(label))
173
  output["sub theme"] = classes
174
  del classification_token, classification_model
 
245
  for x in stqdm(range(len(text))):
246
  tf_o = softmax(tf_outputs["logits"][x], axis=-1)
247
  label = np.argmax(tf_o, axis=0)
248
+ keys = sub_themes_dict
249
  classes.append(keys.get(label))
250
  output["sub theme"] = classes
251
  del classification_token, classification_model
 
293
  keys = model_classes
294
  classes.append(keys.get(label))
295
  output["category"] = classes
296
+ del classification_token, classification_model
297
  if sub_theme:
298
  classification_token, classification_model = classify_sub_theme()
299
  tf_batch = classification_token(
 
310
  for x in stqdm(range(len(text))):
311
  tf_o = softmax(tf_outputs["logits"][x], axis=-1)
312
  label = np.argmax(tf_o, axis=0)
313
+ keys = sub_themes_dict
314
  classes.append(keys.get(label))
315
  output["sub theme"] = classes
316
  del classification_token, classification_model