ShreyaRao commited on
Commit
e334159
β€’
1 Parent(s): d06aaa0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -70,16 +70,28 @@ if button:
70
  if text:
71
  if model == "Transformer":
72
  st.write("You have selected Transformer model.")
73
- summary = transform_summarize(text)
 
 
 
74
  elif model == "T5":
75
  st.write("You have selected T5 model.")
76
- summary = t5_summarize(text)
 
 
 
77
  elif model == "BART":
78
  st.write("You have selected BART model.")
79
- summary = bart_summarize(text)
 
 
 
80
  elif model == "Encoder-Decoder":
81
  st.write("You have selected Encoder-Decoder model.")
82
- summary = encoder_decoder(text)
 
 
 
83
 
84
  #st.toast("Please wait while we summarize your text.")
85
  #with st.spinner("Summarizing..."):
 
70
  if text:
71
  if model == "Transformer":
72
  st.write("You have selected Transformer model.")
73
+ try:
74
+ summary = transform_summarize(text)
75
+ except Exception:
76
+ st.warning("🚨 Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
77
  elif model == "T5":
78
  st.write("You have selected T5 model.")
79
+ try:
80
+ summary = t5_summarize(text)
81
+ except Exception:
82
+ st.warning("🚨 Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
83
  elif model == "BART":
84
  st.write("You have selected BART model.")
85
+ try:
86
+ summary = bart_summarize(text)
87
+ except Exception:
88
+ st.warning("🚨 Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
89
  elif model == "Encoder-Decoder":
90
  st.write("You have selected Encoder-Decoder model.")
91
+ try:
92
+ summary = encoder_decoder(text)
93
+ except Exception:
94
+ st.warning("🚨 Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
95
 
96
  #st.toast("Please wait while we summarize your text.")
97
  #with st.spinner("Summarizing..."):