nicoladisabato commited on
Commit
b3d04f6
Β·
1 Parent(s): c989aa1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -7
app.py CHANGED
@@ -1,8 +1,16 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- st.set_page_config(page_title='πŸ–ŠπŸ“„ Chat Summarization WebApp')
5
- st.title('πŸ–ŠπŸ“„ Chat Summarization WebApp')
 
 
 
 
 
 
 
 
6
 
7
  predefined_text = """Nico: the moon is very beautiful tonight.
8
  Demo: I agree with you.
@@ -19,9 +27,11 @@ button = st.button('Summarize')
19
 
20
  if button:
21
  progress_text = "Model loading. Please wait."
22
- with st.spinner(progress_text):
 
23
  pipe = pipeline("summarization", model="nicoladisabato/pegasus-samsum")
24
- progress_text = "Summarization in progress. Please wait."
25
- with st.spinner(progress_text):
26
- out = pipe(text)
27
- st.json(out)
 
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ st.set_page_config(page_title='πŸ“œβœ‚οΈ Chat Summarizer πŸ“„πŸ”')
5
+ st.title('πŸ“œβœ‚οΈ Chat Summarizer πŸ“„πŸ”')
6
+
7
+
8
+ # Define available models and their corresponding names
9
+ models = {
10
+ "PEGASUS fine-tuned": "nicoladisabato/pegasus-samsum"
11
+ }
12
+
13
+ selected_model = st.selectbox("Select a model", list(models.keys()))
14
 
15
  predefined_text = """Nico: the moon is very beautiful tonight.
16
  Demo: I agree with you.
 
27
 
28
  if button:
29
  progress_text = "Model loading. Please wait."
30
+ spinner = st.spinner(progress_text)
31
+ with spinner:
32
  pipe = pipeline("summarization", model="nicoladisabato/pegasus-samsum")
33
+ spinner.stop()
34
+ progress_text = "Summarization in progress. Please wait."
35
+ with st.spinner(progress_text):
36
+ out = pipe(text)
37
+ st.json(out)