ashhadahsan commited on
Commit
58f1444
·
1 Parent(s): 74e3a69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -31,8 +31,8 @@ model_classes = {
31
  }
32
 
33
 
34
- # @st.cache(allow_output_mutation=True, suppress_st_warning=True)
35
- @st.cache_resource
36
  def load_t5():
37
  model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
38
 
@@ -40,35 +40,35 @@ def load_t5():
40
  return model, tokenizer
41
 
42
 
43
- # @st.cache(allow_output_mutation=True, suppress_st_warning=True)
44
- @st.cache_resource
45
  def custom_model():
46
  return pipeline("summarization", model="my_awesome_sum/")
47
 
48
 
49
- # @st.cache(allow_output_mutation=True, suppress_st_warning=True)
50
- @st.cache_resource
51
  def convert_df(df):
52
  # IMPORTANT: Cache the conversion to prevent computation on every rerun
53
  return df.to_csv(index=False).encode("utf-8")
54
 
55
 
56
- # @st.cache(allow_output_mutation=True, suppress_st_warning=True)
57
- @st.cache_resource
58
  def load_one_line_summarizer(model):
59
  return model.load_model("t5", "snrspeaks/t5-one-line-summary")
60
 
61
 
62
- # @st.cache(allow_output_mutation=True, suppress_st_warning=True)
63
- @st.cache_resource
64
  def classify_category():
65
  tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
66
  new_model = load_model("model")
67
  return tokenizer, new_model
68
 
69
 
70
- # @st.cache(allow_output_mutation=True, suppress_st_warning=True)
71
- @st.cache_resource
72
  def classify_sub_theme():
73
  tokenizer = BertTokenizer.from_pretrained(
74
  "ashhadahsan/amazon-subtheme-bert-base-finetuned"
 
31
  }
32
 
33
 
34
+ @st.cache(allow_output_mutation=True, suppress_st_warning=True)
35
+ # @st.cache_resource
36
  def load_t5():
37
  model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
38
 
 
40
  return model, tokenizer
41
 
42
 
43
+ @st.cache(allow_output_mutation=True, suppress_st_warning=True)
44
+ # @st.cache_resource
45
  def custom_model():
46
  return pipeline("summarization", model="my_awesome_sum/")
47
 
48
 
49
+ @st.cache(allow_output_mutation=True, suppress_st_warning=True)
50
+ # @st.cache_resource
51
  def convert_df(df):
52
  # IMPORTANT: Cache the conversion to prevent computation on every rerun
53
  return df.to_csv(index=False).encode("utf-8")
54
 
55
 
56
+ @st.cache(allow_output_mutation=True, suppress_st_warning=True)
57
+ # @st.cache_resource
58
  def load_one_line_summarizer(model):
59
  return model.load_model("t5", "snrspeaks/t5-one-line-summary")
60
 
61
 
62
+ @st.cache(allow_output_mutation=True, suppress_st_warning=True)
63
+ # @st.cache_resource
64
  def classify_category():
65
  tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
66
  new_model = load_model("model")
67
  return tokenizer, new_model
68
 
69
 
70
+ @st.cache(allow_output_mutation=True, suppress_st_warning=True)
71
+ # @st.cache_resource
72
  def classify_sub_theme():
73
  tokenizer = BertTokenizer.from_pretrained(
74
  "ashhadahsan/amazon-subtheme-bert-base-finetuned"