richardorama commited on
Commit
a4dab2d
1 Parent(s): ed1e71a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -57,8 +57,7 @@ SENTIMENT = st.sidebar.text_area('Enter Sentiment', DEFAULT_SENTIMENT, height=15
57
  # Define the summarization function
58
  def summarize(txt):
59
 
60
- txt_converted = summarize(ast.literal_eval(txt)) #convert string to actual content, e.g. list
61
- st.write(f'xxxxxxxxxx {txt_converted}')
62
 
63
  st.write('\n\n')
64
  #st.write(txt[:100]) # Display the first 100 characters of the article
@@ -68,7 +67,8 @@ def summarize(txt):
68
  results = sentiment_pipeline(txt_converted)
69
 
70
  # Display the results
71
- if type(txt_converted) == 'list':
 
72
  for i, text in enumerate(txt_converted):
73
  st.write(f"Text: {text}")
74
  st.write(f"Sentiment: {results[i]['label']}, Score: {results[i]['score']:.2f}\n")
 
57
  # Define the summarization function
58
  def summarize(txt):
59
 
60
+ txt_converted = ast.literal_eval(txt) #convert string to actual content, e.g. list
 
61
 
62
  st.write('\n\n')
63
  #st.write(txt[:100]) # Display the first 100 characters of the article
 
67
  results = sentiment_pipeline(txt_converted)
68
 
69
  # Display the results
70
+ #if type(txt_converted) == 'list':
71
+ if isinstance(txt_converted, list):
72
  for i, text in enumerate(txt_converted):
73
  st.write(f"Text: {text}")
74
  st.write(f"Sentiment: {results[i]['label']}, Score: {results[i]['score']:.2f}\n")