Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
st.set_page_config(page_title='ππ Chat Summarization WebApp') | |
st.title('ππ Chat Summarization WebApp') | |
predefined_text = """Nico: the moon is very beautiful tonight. | |
Demo: I agree with you. | |
Nico: My dream is to go to the moon one day. | |
Demo: Are you serious? I'm scared about the space. | |
Nico: So won't you come? | |
Demo: I prefer to go to Lido Le Canne in Pulsano. | |
Nico: Ahahah | |
""" | |
progress_text = "Model loading. Please wait." | |
text = st.text_area("Enter your chat", value=predefined_text, height=200) | |
button = st.button('Summarize') | |
if button: | |
st.progress(0) | |
# Load the pipeline with progress visualization | |
def load_pipeline(): | |
pipe = pipeline("summarization", model="nicoladisabato/pegasus-samsum") | |
return pipe | |
pipe = st.cache(load_pipeline)() | |
st.progress(100) | |
out = pipe(text) | |
st.json(out) |