Spaces:
Runtime error
Runtime error
Commit
·
caaddd5
1
Parent(s):
ba7da0d
Update app.py
Browse files
app.py
CHANGED
@@ -17,24 +17,15 @@ progress_text = "Model loading. Please wait."
|
|
17 |
text = st.text_area("Enter your chat", value=predefined_text, height=200)
|
18 |
button = st.button('Summarize')
|
19 |
|
20 |
-
def load_pipeline():
|
21 |
-
pipe = pipeline("summarization", model="nicoladisabato/pegasus-samsum")
|
22 |
-
return pipe
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
# Load the pipeline with progress visualization
|
28 |
-
@st.cache(hash_funcs={pipeline: lambda _: None}) # Disable hashing for pipeline
|
29 |
-
def cached_load_pipeline():
|
30 |
-
return load_pipeline()
|
31 |
-
|
32 |
-
with st.spinner("Loading model..."):
|
33 |
-
pipe = cached_load_pipeline()
|
34 |
-
|
35 |
-
st.success("Model loaded.")
|
36 |
-
|
37 |
-
st.text("Generating summary...")
|
38 |
-
out = pipe(text)
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
text = st.text_area("Enter your chat", value=predefined_text, height=200)
|
18 |
button = st.button('Summarize')
|
19 |
|
|
|
|
|
|
|
20 |
|
21 |
+
text = st.text_area("Enter your chat", value=predefined_text, height=200)
|
22 |
+
button = st.button('Summarize')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
if button:
|
25 |
+
progress_text = "Model loading. Please wait."
|
26 |
+
with st.spinner(progress_text):
|
27 |
+
pipe = pipeline("summarization", model="nicoladisabato/pegasus-samsum")
|
28 |
+
progress_text = "Summarization in progress. Please wait."
|
29 |
+
with st.spinner(progress_text):
|
30 |
+
out = pipe(text)
|
31 |
+
st.json(out)
|