Spaces:
Runtime error
Runtime error
Commit
·
0a2b9be
1
Parent(s):
f16d91a
Update app.py
Browse files
app.py
CHANGED
@@ -17,15 +17,20 @@ 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 |
if button:
|
21 |
-
st.
|
22 |
-
|
23 |
-
# Load the pipeline with progress visualization
|
24 |
-
|
25 |
-
pipe =
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
st.
|
30 |
out = pipe(text)
|
|
|
31 |
st.json(out)
|
|
|
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 |
if button:
|
25 |
+
st.text(progress_text)
|
26 |
+
|
27 |
+
# Load the pipeline with progress visualization
|
28 |
+
with st.spinner("Loading model..."):
|
29 |
+
pipe = st.cache(load_pipeline)()
|
30 |
+
|
31 |
+
st.success("Model loaded.")
|
32 |
+
|
33 |
+
st.text("Generating summary...")
|
34 |
out = pipe(text)
|
35 |
+
|
36 |
st.json(out)
|