nlpblogs commited on
Commit
0735b99
·
verified ·
1 Parent(s): 0c17b55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -51,8 +51,24 @@ if 'question_attempts' not in st.session_state:
51
 
52
  max_attempts = 5
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
- upload_file = st.file_uploader("Upload your file. Accepted file formats include: .csv, .xlsx", type=['csv', 'xlsx'], label_visibility="collapsed")
56
 
57
  if upload_file is not None:
58
  file_extension = upload_file.name.split('.')[-1].lower()
 
51
 
52
  max_attempts = 5
53
 
54
+ MAX_FILE_SIZE_KB = 10
55
+ MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_KB * 1024
56
+
57
+
58
+ upload_file = st.file_uploader("Upload your file. Accepted file formats include: .csv, .xlsx", type=['csv', 'xlsx'])
59
+
60
+ if upload_file is not None:
61
+ if upload_file.size > MAX_FILE_SIZE_BYTES:
62
+ st.error(f"Error: The uploaded file is too large. Maximum allowed size is {MAX_FILE_SIZE_KB} KB.")
63
+ upload_file = None # Clear the uploaded file to prevent further processing
64
+ else:
65
+ st.success("File uploaded successfully!")
66
+
67
+
68
+
69
+
70
+
71
 
 
72
 
73
  if upload_file is not None:
74
  file_extension = upload_file.name.split('.')[-1].lower()