Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,13 +13,13 @@ st.header("Generate summaries")
|
|
13 |
st_model_load = st.text('Loading summary generator model...')
|
14 |
|
15 |
# # @st.cache(allow_output_mutation=True)
|
16 |
-
|
17 |
-
|
18 |
-
print("Loading model...")
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
# tokenizer, model = load_model()
|
25 |
st.success('Model loaded!')
|
@@ -99,7 +99,7 @@ def generate_summary():
|
|
99 |
st.session_state.summaries = predicted_summaries
|
100 |
|
101 |
# generate title button
|
102 |
-
|
103 |
|
104 |
# title generation labels
|
105 |
if 'summaries' not in st.session_state:
|
|
|
13 |
st_model_load = st.text('Loading summary generator model...')
|
14 |
|
15 |
# # @st.cache(allow_output_mutation=True)
|
16 |
+
@st.cache_data
|
17 |
+
def load_model():
|
18 |
+
print("Loading model...")
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
20 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
21 |
+
nltk.download('punkt')
|
22 |
+
print("Model loaded!")
|
23 |
|
24 |
# tokenizer, model = load_model()
|
25 |
st.success('Model loaded!')
|
|
|
99 |
st.session_state.summaries = predicted_summaries
|
100 |
|
101 |
# generate title button
|
102 |
+
st_generate_button = st.button('Generate summary', on_click=generate_summary)
|
103 |
|
104 |
# title generation labels
|
105 |
if 'summaries' not in st.session_state:
|