frankai98 commited on
Commit
7b1d3eb
·
verified ·
1 Parent(s): ee41d09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -90,9 +90,9 @@ def main():
90
 
91
  candidate_docs = []
92
  if uploaded_file is not None:
93
- # Check if the file size exceeds 3MB (3 * 1024 * 1024 bytes)
94
- if uploaded_file.size > 3 * 1024 * 1024:
95
- st.error("The file is too large! Please upload a file smaller than 3MB.")
96
  else:
97
  try:
98
  df = pd.read_csv(uploaded_file)
@@ -234,7 +234,7 @@ def main():
234
  progress_bar.progress(75)
235
 
236
  import random
237
- max_tweets = 500
238
  if len(scored_docs) > max_tweets:
239
  sampled_docs = random.sample(scored_docs, max_tweets)
240
  st.info(f"Sampling {max_tweets} out of {len(scored_docs)} tweets for report generation")
@@ -244,9 +244,10 @@ def main():
244
  # Build prompt
245
  messages = [
246
  {"role": "user", "content": f"""
247
- Generate a well-structured business report based on tweets from twitter/X with sentiment score (0: negative, 1: neutral, 2: positive) that answers Query Question and meets following Requirements.
248
  **Requirements:**
249
- - Include an introduction, key insights, and a conclusion.
 
250
  - Ensure the analysis is concise and does not cut off abruptly.
251
  - Summarize major findings without repeating verbatim.
252
  - Cover both positive and negative aspects, highlighting trends in user sentiment.
 
90
 
91
  candidate_docs = []
92
  if uploaded_file is not None:
93
+ # Check if the file size exceeds 1MB (1 * 1024 * 1024 bytes)
94
+ if uploaded_file.size > 1 * 1024 * 1024:
95
+ st.error("The file is too large! Please upload a file smaller than 1MB.")
96
  else:
97
  try:
98
  df = pd.read_csv(uploaded_file)
 
234
  progress_bar.progress(75)
235
 
236
  import random
237
+ max_tweets = 1000
238
  if len(scored_docs) > max_tweets:
239
  sampled_docs = random.sample(scored_docs, max_tweets)
240
  st.info(f"Sampling {max_tweets} out of {len(scored_docs)} tweets for report generation")
 
244
  # Build prompt
245
  messages = [
246
  {"role": "user", "content": f"""
247
+ Generate a well-structured business report based on tweets from twitter/X with sentiment score (0: negative, 1: neutral, 2: positive) that answers Query Question and meets following Requirements:
248
  **Requirements:**
249
+ - Do not include any greeting, summary statement, or closing question.
250
+ - Generate only the final report text, starting with the introduction, key insights, and ending with the conclusion.
251
  - Ensure the analysis is concise and does not cut off abruptly.
252
  - Summarize major findings without repeating verbatim.
253
  - Cover both positive and negative aspects, highlighting trends in user sentiment.