ashhadahsan commited on
Commit
fd4da91
·
1 Parent(s): f3ead1a

added more cancel burtons

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -76,9 +76,12 @@ hide_streamlit_style = """
76
  </style>
77
  """
78
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
79
- cancel_button=st.empty()
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
 
@@ -101,6 +104,7 @@ if st.button("Process",type="primary"):
101
  for x in stqdm(range(len(text))):
102
 
103
  if cancel_button.button("Cancel",key=x):
 
104
  break
105
  try:
106
  summary.append(
@@ -146,7 +150,10 @@ if st.button("Process",type="primary"):
146
  model, tokenizer = load_t5()
147
  summary = []
148
  for x in stqdm(range(len(text))):
149
-
 
 
 
150
  tokens_input = tokenizer.encode(
151
  "summarize: " + text[x],
152
  return_tensors="pt",
@@ -202,6 +209,9 @@ if st.button("Process",type="primary"):
202
 
203
  summary = []
204
  for x in stqdm(range(len(text))):
 
 
 
205
  try:
206
  summary.append(model.predict(text[x])[0])
207
  except:
 
76
  </style>
77
  """
78
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
79
+
80
  ps = st.empty()
81
  if st.button("Process",type="primary"):
82
+ cancel_button=st.empty()
83
+ cancel_button2=st.empty()
84
+ cancel_button3=st.empty()
85
  if uploaded_file is not None:
86
  if uploaded_file.name.split(".")[-1] in ["xls", "xlsx"]:
87
 
 
104
  for x in stqdm(range(len(text))):
105
 
106
  if cancel_button.button("Cancel",key=x):
107
+ del model
108
  break
109
  try:
110
  summary.append(
 
150
  model, tokenizer = load_t5()
151
  summary = []
152
  for x in stqdm(range(len(text))):
153
+
154
+ if cancel_button2.button("Cancel",key=x):
155
+ del model,tokenizer
156
+ break
157
  tokens_input = tokenizer.encode(
158
  "summarize: " + text[x],
159
  return_tensors="pt",
 
209
 
210
  summary = []
211
  for x in stqdm(range(len(text))):
212
+ if cancel_button3.button("Cancel",key=x):
213
+ del model
214
+ break
215
  try:
216
  summary.append(model.predict(text[x])[0])
217
  except: