Spaces:
Sleeping
Sleeping
akhilhsingh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -6,16 +6,16 @@ from collections import defaultdict
|
|
6 |
from datetime import datetime
|
7 |
|
8 |
# AWS S3 setup
|
9 |
-
os.environ['AWS_ACCESS_KEY']
|
10 |
-
os.environ['AWS_SECRET_KEY']
|
11 |
-
os.environ['BUCKET_NAME']
|
12 |
|
13 |
# Initialize a session using DigitalOcean Spaces
|
14 |
session = boto3.session.Session()
|
15 |
s3 = session.client('s3',
|
16 |
region_name='us-west-2', # Update to the correct region
|
17 |
-
aws_access_key_id
|
18 |
-
aws_secret_access_key
|
19 |
|
20 |
def list_folders(bucket_name):
|
21 |
try:
|
@@ -59,12 +59,12 @@ def count_files_in_folder(bucket_name, prefix):
|
|
59 |
st.title('NeuroSinQ IAT Completions Dashboard')
|
60 |
|
61 |
# Dropdown to select folder
|
62 |
-
folders = list_folders(
|
63 |
#selected_folder = st.selectbox('Select a folder', folders)
|
64 |
selected_folder = st.selectbox('Select a folder', folders, disabled=True, index=folders.index('JUNIPER/') if 'JUNIPER/' in folders else 0)
|
65 |
# Display file counts
|
66 |
if selected_folder:
|
67 |
-
folder_counts = count_files_in_folder(
|
68 |
|
69 |
if folder_counts:
|
70 |
# Collect all dates
|
|
|
6 |
from datetime import datetime
|
7 |
|
8 |
# AWS S3 setup
|
9 |
+
aws_access_key_id=os.environ['AWS_ACCESS_KEY']
|
10 |
+
aws_secret_access_key=os.environ['AWS_SECRET_KEY']
|
11 |
+
aws_bucket=os.environ['BUCKET_NAME']
|
12 |
|
13 |
# Initialize a session using DigitalOcean Spaces
|
14 |
session = boto3.session.Session()
|
15 |
s3 = session.client('s3',
|
16 |
region_name='us-west-2', # Update to the correct region
|
17 |
+
aws_access_key_id,
|
18 |
+
aws_secret_access_key)
|
19 |
|
20 |
def list_folders(bucket_name):
|
21 |
try:
|
|
|
59 |
st.title('NeuroSinQ IAT Completions Dashboard')
|
60 |
|
61 |
# Dropdown to select folder
|
62 |
+
folders = list_folders(aws_bucket)
|
63 |
#selected_folder = st.selectbox('Select a folder', folders)
|
64 |
selected_folder = st.selectbox('Select a folder', folders, disabled=True, index=folders.index('JUNIPER/') if 'JUNIPER/' in folders else 0)
|
65 |
# Display file counts
|
66 |
if selected_folder:
|
67 |
+
folder_counts = count_files_in_folder(aws_bucket, selected_folder)
|
68 |
|
69 |
if folder_counts:
|
70 |
# Collect all dates
|