kusa04 commited on
Commit
24fc46f
·
verified ·
1 Parent(s): d6d3d88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -27,6 +27,11 @@ from functions import (
27
  preprocess_text
28
  )
29
 
 
 
 
 
 
30
  st.title("Reddit Scraping & Sentiment Analysis")
31
 
32
  # --- User Input ---
@@ -58,7 +63,7 @@ if st.button("Scrape and Sentiment Analysis"):
58
  # Perform sentiment analysis
59
  with st.spinner("Doing Sentiment Analysis..."):
60
  # Analyze Title sentiment directly (assuming the title is short)
61
- df['title_sentiment'] = df['Title'].apply(lambda x: safe_sentiment(sentiment_pipeline, preprocess_text(x)) if x else None)
62
  # Analyze Detail sentiment by splitting into token-limited chunks and accumulating scores
63
  df['detail_sentiment'] = df['Detail'].apply(lambda x: analyze_detail(x, tokenizer, sentiment_pipeline, max_tokens) if x else None)
64
 
 
27
  preprocess_text
28
  )
29
 
30
+
31
+
32
+
33
+
34
+
35
  st.title("Reddit Scraping & Sentiment Analysis")
36
 
37
  # --- User Input ---
 
63
  # Perform sentiment analysis
64
  with st.spinner("Doing Sentiment Analysis..."):
65
  # Analyze Title sentiment directly (assuming the title is short)
66
+ df['title_sentiment'] = df['Title'].apply(lambda x: safe_sentiment(sentiment_pipeline, text=preprocess_text(x)) if x else None)
67
  # Analyze Detail sentiment by splitting into token-limited chunks and accumulating scores
68
  df['detail_sentiment'] = df['Detail'].apply(lambda x: analyze_detail(x, tokenizer, sentiment_pipeline, max_tokens) if x else None)
69