ashhadahsan commited on
Commit
37055d8
·
1 Parent(s): 7f11aa9

removed cancelled button

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -12,7 +12,7 @@ from datetime import datetime
12
  import logging
13
 
14
  date = datetime.now().strftime(r"%Y-%m-%d")
15
- model_classes = {
16
  0: "Ads",
17
  1: "Apps",
18
  2: "Battery",
@@ -29,7 +29,6 @@ model_classes = {
29
  13: "WiFi",
30
  }
31
 
32
-
33
  @st.cache
34
  def load_t5():
35
  model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
@@ -79,7 +78,7 @@ hide_streamlit_style = """
79
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
80
 
81
  ps = st.empty()
82
- if st.button("Process", type="primary"):
83
  if uploaded_file is not None:
84
  if uploaded_file.name.split(".")[-1] in ["xls", "xlsx"]:
85
 
@@ -100,8 +99,6 @@ if st.button("Process", type="primary"):
100
  summary = []
101
 
102
  for x in stqdm(range(len(text))):
103
- if st.button("Cancel"):
104
- break
105
  try:
106
  summary.append(
107
  model(
@@ -146,8 +143,6 @@ if st.button("Process", type="primary"):
146
  model, tokenizer = load_t5()
147
  summary = []
148
  for x in stqdm(range(len(text))):
149
- if st.button("Cancel"):
150
- break
151
 
152
  tokens_input = tokenizer.encode(
153
  "summarize: " + text[x],
@@ -204,9 +199,6 @@ if st.button("Process", type="primary"):
204
 
205
  summary = []
206
  for x in stqdm(range(len(text))):
207
-
208
- if st.button("Cancel"):
209
- break
210
  try:
211
  summary.append(model.predict(text[x])[0])
212
  except:
@@ -249,4 +241,4 @@ if st.button("Process", type="primary"):
249
  )
250
  st.info("Text column must have amazon reviews", icon="ℹ️")
251
  except BaseException as e:
252
- logging.exception("An exception was occurred")
 
12
  import logging
13
 
14
  date = datetime.now().strftime(r"%Y-%m-%d")
15
+ model_classes ={
16
  0: "Ads",
17
  1: "Apps",
18
  2: "Battery",
 
29
  13: "WiFi",
30
  }
31
 
 
32
  @st.cache
33
  def load_t5():
34
  model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
 
78
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
79
 
80
  ps = st.empty()
81
+ if st.button("Process",type="primary"):
82
  if uploaded_file is not None:
83
  if uploaded_file.name.split(".")[-1] in ["xls", "xlsx"]:
84
 
 
99
  summary = []
100
 
101
  for x in stqdm(range(len(text))):
 
 
102
  try:
103
  summary.append(
104
  model(
 
143
  model, tokenizer = load_t5()
144
  summary = []
145
  for x in stqdm(range(len(text))):
 
 
146
 
147
  tokens_input = tokenizer.encode(
148
  "summarize: " + text[x],
 
199
 
200
  summary = []
201
  for x in stqdm(range(len(text))):
 
 
 
202
  try:
203
  summary.append(model.predict(text[x])[0])
204
  except:
 
241
  )
242
  st.info("Text column must have amazon reviews", icon="ℹ️")
243
  except BaseException as e:
244
+ logging.exception("An exception was occurred")