nicoladisabato commited on
Commit
563ff9f
Β·
1 Parent(s): 7576a55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -3,10 +3,6 @@ from transformers import pipeline
3
  from tqdm import tqdm
4
  import time
5
 
6
- def estimate_loading_time():
7
- total_steps = 100 # Adjust the total steps as needed
8
- for _ in tqdm(range(total_steps), desc="Loading model..."):
9
- time.sleep(0.05) # Simulate loading time
10
 
11
  st.set_page_config(page_title='πŸ“œβœ‚οΈ Chat Summarizer πŸ“„πŸ”')
12
  st.title('πŸ“œβœ‚οΈ Chat Summarizer πŸ“„πŸ”')
@@ -14,7 +10,7 @@ st.title('πŸ“œβœ‚οΈ Chat Summarizer πŸ“„πŸ”')
14
 
15
  # Define available models and their corresponding names
16
  models = {
17
- "PEGASUS fine-tuned": "nicoladisabato/pegasus-samsum"
18
  }
19
 
20
  selected_model = st.selectbox("Select a model", list(models.keys()))
@@ -27,18 +23,16 @@ Nico: So won't you come?
27
  Demo: I prefer to go to Lido Le Canne in Pulsano.
28
  Nico: Ahahah
29
  """
30
- progress_text = "Model loading. Please wait."
31
 
32
  text = st.text_area("Enter your chat", value=predefined_text, height=200)
33
  button = st.button('Summarize')
34
 
35
  if button:
36
- progress_text = "Model loading. Please wait."
37
  spinner = st.spinner(progress_text)
38
  with spinner:
39
- estimate_loading_time()
40
  pipe = pipeline("summarization", model="nicoladisabato/pegasus-samsum")
41
- progress_text = "Summarization in progress. Please wait."
42
  with st.spinner(progress_text):
43
  out = pipe(text)
44
  st.json(out)
 
3
  from tqdm import tqdm
4
  import time
5
 
 
 
 
 
6
 
7
  st.set_page_config(page_title='πŸ“œβœ‚οΈ Chat Summarizer πŸ“„πŸ”')
8
  st.title('πŸ“œβœ‚οΈ Chat Summarizer πŸ“„πŸ”')
 
10
 
11
  # Define available models and their corresponding names
12
  models = {
13
+ "nicoladisabato/pegasus-samsum": "nicoladisabato/pegasus-samsum"
14
  }
15
 
16
  selected_model = st.selectbox("Select a model", list(models.keys()))
 
23
  Demo: I prefer to go to Lido Le Canne in Pulsano.
24
  Nico: Ahahah
25
  """
 
26
 
27
  text = st.text_area("Enter your chat", value=predefined_text, height=200)
28
  button = st.button('Summarize')
29
 
30
  if button:
31
+ progress_text = "Loading the pipeline. It will take a minute :)"
32
  spinner = st.spinner(progress_text)
33
  with spinner:
 
34
  pipe = pipeline("summarization", model="nicoladisabato/pegasus-samsum")
35
+ progress_text = "Summarization in progress."
36
  with st.spinner(progress_text):
37
  out = pipe(text)
38
  st.json(out)