DevBM commited on
Commit
8e40fe0
1 Parent(s): c882126

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,7 +23,7 @@ nlp = spacy.load("en_core_web_sm")
23
  user_agent = 'QGen/1.0 (channingfisher7@gmail.com)'
24
  wiki_wiki = wikipediaapi.Wikipedia(user_agent= user_agent,language='en')
25
 
26
- @st.cache_resources(allow_output_mutation=True)
27
  def load_model():
28
  model_name = "DevBM/t5-large-squad"
29
  model = T5ForConditionalGeneration.from_pretrained(model_name)
@@ -182,7 +182,7 @@ with st.sidebar:
182
  question_complexity = st.selectbox("Select question complexity", ["Simple", "Intermediate", "Complex"])
183
  if st.button("Generate Questions"):
184
  if text:
185
- load_model()
186
  keywords = extract_keywords(text)
187
  keyword_sentence_mapping = map_keywords_to_sentences(text, keywords, context_window_size)
188
 
 
23
  user_agent = 'QGen/1.0 (channingfisher7@gmail.com)'
24
  wiki_wiki = wikipediaapi.Wikipedia(user_agent= user_agent,language='en')
25
 
26
+ @st.cache_resource(allow_output_mutation=True)
27
  def load_model():
28
  model_name = "DevBM/t5-large-squad"
29
  model = T5ForConditionalGeneration.from_pretrained(model_name)
 
182
  question_complexity = st.selectbox("Select question complexity", ["Simple", "Intermediate", "Complex"])
183
  if st.button("Generate Questions"):
184
  if text:
185
+ model, tokenizer = load_model()
186
  keywords = extract_keywords(text)
187
  keyword_sentence_mapping = map_keywords_to_sentences(text, keywords, context_window_size)
188