nlpblogs commited on
Commit
6901dd4
·
verified ·
1 Parent(s): 4307f05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -77,7 +77,7 @@ model = transformers.DistilBertForSequenceClassification.from_pretrained("tabula
77
  if 'url_count' not in st.session_state:
78
  st.session_state['url_count'] = 0
79
 
80
- max_attempts = 2
81
 
82
  def update_url_count():
83
  st.session_state['url_count'] += 1
@@ -112,7 +112,7 @@ if st.button("Sentiment Analysis", type="secondary"):
112
  body = WebDriverWait(driver, 30).until(EC.visibility_of_element_located((By.TAG_NAME, "body")))
113
  body.send_keys(Keys.END)
114
  placeholder.text(f"Scrolled {item + 1} times")
115
- progress_bar.progress((item + 1) / 150)
116
  time.sleep(0.5)
117
  except Exception as e:
118
  st.error(f"Exception during scrolling: {e}")
@@ -129,6 +129,8 @@ if st.button("Sentiment Analysis", type="secondary"):
129
  for comment in comments:
130
  timestamp = datetime.now().strftime("%Y-%m-%d")
131
  data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
 
 
132
  user_id += 1
133
  data = [dict(t) for t in {tuple(d.items()) for d in data}]
134
  except Exception as e:
 
77
  if 'url_count' not in st.session_state:
78
  st.session_state['url_count'] = 0
79
 
80
+ max_attempts = 5
81
 
82
  def update_url_count():
83
  st.session_state['url_count'] += 1
 
112
  body = WebDriverWait(driver, 30).until(EC.visibility_of_element_located((By.TAG_NAME, "body")))
113
  body.send_keys(Keys.END)
114
  placeholder.text(f"Scrolled {item + 1} times")
115
+ progress_bar.progress((item + 1) / 30)
116
  time.sleep(0.5)
117
  except Exception as e:
118
  st.error(f"Exception during scrolling: {e}")
 
129
  for comment in comments:
130
  timestamp = datetime.now().strftime("%Y-%m-%d")
131
  data.append({"User ID": user_id, "Comment": comment.text, "comment_date": timestamp})
132
+
133
+
134
  user_id += 1
135
  data = [dict(t) for t in {tuple(d.items()) for d in data}]
136
  except Exception as e: