peterciank commited on
Commit
d7a8932
Β·
verified Β·
1 Parent(s): 44f1a7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -9,7 +9,7 @@ from fuzzywuzzy import fuzz
9
  st.title("Exploring Torch, Transformers, Rake, and Others analyzing Text")
10
 
11
  # Define the options for the dropdown menu, Selecting a remote txt file already created to analyze the text
12
- options = ['Apprecitation Letter', 'Regret Letter', 'Kindness Tale', 'Lost Melody Tale', 'Twitter Example 1', 'Twitter Example 2']
13
 
14
  # Create a dropdown menu to select options
15
  selected_option = st.selectbox("Select a preset option", options)
@@ -40,10 +40,10 @@ def fetch_text_content(selected_option):
40
  return ""
41
 
42
  # Fetch text content based on selected option
43
- text_content = fetch_text_content(selected_option)
44
 
45
  # Display text content in a text area
46
- jd = st.text_area("Text File Content", text_content)
47
 
48
 
49
  # Download NLTK resources
@@ -90,7 +90,7 @@ text = st.text_area('Enter the text to analyze', jd)
90
 
91
  if text:
92
 
93
- with st.expander("Sentiment Analysis", expanded=True):
94
  # Sentiment analysis
95
  out_sentiment = pipe_sent(text)
96
  # Display sentiment analysis result
@@ -99,18 +99,15 @@ if text:
99
  sentiment_emoji = '😊' if sentiment_label == 'POSITIVE' else '😞'
100
  sentiment_text = f"Sentiment Score: {sentiment_score}, Sentiment Label: {sentiment_label.capitalize()} {sentiment_emoji}"
101
  st.write(sentiment_text)
102
- st.write("βœ… Completed")
103
 
104
- with st.expander("Summarization", expanded=True):
105
  # Summarization
106
  out_summ = pipe_summ(text)
107
  summarized_text = out_summ[0]['summary_text']
108
  st.write(summarized_text)
109
- st.write("βœ… Completed")
110
 
111
- with st.expander("Keywords Extraction", expanded=True):
112
  # Keyword extraction
113
  keywords = extract_keywords(text)
114
  keyword_list = [keyword[1] for keyword in keywords]
115
  st.write(keyword_list)
116
- st.write("βœ… Completed")
 
9
  st.title("Exploring Torch, Transformers, Rake, and Others analyzing Text")
10
 
11
  # Define the options for the dropdown menu, Selecting a remote txt file already created to analyze the text
12
+ options = ['None','Apprecitation Letter', 'Regret Letter', 'Kindness Tale', 'Lost Melody Tale', 'Twitter Example 1', 'Twitter Example 2']
13
 
14
  # Create a dropdown menu to select options
15
  selected_option = st.selectbox("Select a preset option", options)
 
40
  return ""
41
 
42
  # Fetch text content based on selected option
43
+ jd = fetch_text_content(selected_option)
44
 
45
  # Display text content in a text area
46
+ #jd = st.text_area("Text File Content", text_content)
47
 
48
 
49
  # Download NLTK resources
 
90
 
91
  if text:
92
 
93
+ with st.expander("Sentiment Analysis - βœ… Completed", expanded=False):
94
  # Sentiment analysis
95
  out_sentiment = pipe_sent(text)
96
  # Display sentiment analysis result
 
99
  sentiment_emoji = '😊' if sentiment_label == 'POSITIVE' else '😞'
100
  sentiment_text = f"Sentiment Score: {sentiment_score}, Sentiment Label: {sentiment_label.capitalize()} {sentiment_emoji}"
101
  st.write(sentiment_text)
 
102
 
103
+ with st.expander("Summarization - βœ… Completed", expanded=False):
104
  # Summarization
105
  out_summ = pipe_summ(text)
106
  summarized_text = out_summ[0]['summary_text']
107
  st.write(summarized_text)
 
108
 
109
+ with st.expander("Keywords Extraction - βœ… Completed", expanded=False):
110
  # Keyword extraction
111
  keywords = extract_keywords(text)
112
  keyword_list = [keyword[1] for keyword in keywords]
113
  st.write(keyword_list)