frankai98 commited on
Commit
b393a11
·
verified ·
1 Parent(s): 6521a16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -90,14 +90,20 @@ def main():
90
 
91
  candidate_docs = []
92
  if uploaded_file is not None:
93
- try:
94
- df = pd.read_csv(uploaded_file)
95
- if tweets_column not in df.columns:
96
- st.error(f"CSV must contain a '{tweets_column}' column.")
97
- else:
98
- candidate_docs = df[tweets_column].dropna().astype(str).tolist()
99
- except Exception as e:
100
- st.error(f"Error reading CSV file: {e}")
 
 
 
 
 
 
101
 
102
  if st.button("Generate Report🗟"):
103
  # Reset timer state so that the timer always shows up
 
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)
99
+ if tweets_column not in df.columns:
100
+ st.error(f"CSV must contain a '{tweets_column}' column.")
101
+ else:
102
+ candidate_docs = df[tweets_column].dropna().astype(str).tolist()
103
+ # Process your CSV file here...
104
+ st.write("File uploaded successfully!🎆")
105
+ except Exception as e:
106
+ st.error(f"Error reading CSV file: {e}")
107
 
108
  if st.button("Generate Report🗟"):
109
  # Reset timer state so that the timer always shows up