richardorama commited on
Commit
35ef636
β€’
1 Parent(s): 85c2bc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -3,6 +3,7 @@
3
 
4
  import streamlit as st
5
  from transformers import pipeline
 
6
 
7
  # Load the summarization model
8
  #summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") # smaller version of the model
@@ -70,6 +71,9 @@ def summarize(txt):
70
 
71
  # Create a button and trigger the summarize function when clicked
72
  if st.sidebar.button('Summarize Sentiment'):
 
 
 
73
  summarize(ast.literal_eval(SENTIMENT)) #convert string to actual list
74
  else:
75
  st.warning('πŸ‘ˆ Please enter Sentiment!')
 
3
 
4
  import streamlit as st
5
  from transformers import pipeline
6
+ import ast
7
 
8
  # Load the summarization model
9
  #summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") # smaller version of the model
 
71
 
72
  # Create a button and trigger the summarize function when clicked
73
  if st.sidebar.button('Summarize Sentiment'):
74
+ #ast.literal_eval() is a function in Python that safely evaluates a string containing a valid Python expression,
75
+ #such as lists, dictionaries, tuples, sets, integers, and floats. It parses the string and returns the corresponding
76
+ #Python object, without executing any arbitrary code, which makes it safer than using eval().
77
  summarize(ast.literal_eval(SENTIMENT)) #convert string to actual list
78
  else:
79
  st.warning('πŸ‘ˆ Please enter Sentiment!')