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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
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,6 +29,7 @@ model_classes ={
29
  13: "WiFi",
30
  }
31
 
 
32
  @st.cache
33
  def load_t5():
34
  model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
@@ -78,7 +79,7 @@ hide_streamlit_style = """
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,7 +100,7 @@ if st.button("Process",type="primary"):
99
  summary = []
100
 
101
  for x in stqdm(range(len(text))):
102
- if st.button("Cancel"):
103
  break
104
  try:
105
  summary.append(
@@ -147,8 +148,7 @@ if st.button("Process",type="primary"):
147
  for x in stqdm(range(len(text))):
148
  if st.button("Cancel"):
149
  break
150
-
151
-
152
  tokens_input = tokenizer.encode(
153
  "summarize: " + text[x],
154
  return_tensors="pt",
@@ -204,7 +204,8 @@ if st.button("Process",type="primary"):
204
 
205
  summary = []
206
  for x in stqdm(range(len(text))):
207
- if st.button("Cancel"):
 
208
  break
209
  try:
210
  summary.append(model.predict(text[x])[0])
 
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
+
33
  @st.cache
34
  def load_t5():
35
  model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
 
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
  summary = []
101
 
102
  for x in stqdm(range(len(text))):
103
+ if st.button("Cancel"):
104
  break
105
  try:
106
  summary.append(
 
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],
154
  return_tensors="pt",
 
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])