File size: 907 Bytes
c888ee1
 
 
8719562
 
4189555
d2c9fdb
8719562
 
 
 
 
 
 
f16d91a
8719562
 
3cd61f5
c888ee1
3cd61f5
f16d91a
 
 
 
 
 
 
 
 
c888ee1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)