Skip to content

Commit 22ca411

Browse files
authored
Add files via upload
1 parent 88917f6 commit 22ca411

File tree

1 file changed

+58
-18
lines changed

1 file changed

+58
-18
lines changed

streamlit_app.py

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,96 @@
11
import streamlit as st
22
import pandas as pd
33

4+
# Set page configuration (optional but recommended for a library app)
5+
st.set_page_config(page_title="Scientific Slide Library", layout="wide")
6+
47
# 5) BACKGROUND COLOR - Tag: BACKGROUND_STYLE
5-
# Fixed the parameter here to 'unsafe_allow_html=True'
8+
# This changes the main app background to light grey
69
st.markdown(
710
"""
811
<style>
912
.stApp {
1013
background-color: #f0f0f0;
1114
}
15+
/* Optional: Makes the dataframe container stand out slightly */
16+
.stDataFrame {
17+
background-color: white;
18+
border-radius: 5px;
19+
padding: 10px;
20+
}
1221
</style>
1322
""",
1423
unsafe_allow_html=True
1524
)
1625

1726
# 4) HEADER TEXT - Tag: HEADER_SECTION
18-
# Edit the text between the quotes to change your page header
19-
st.title("Document Management Library")
27+
# You can edit the text inside the triple quotes below
28+
st.title("Scientific Slide Library")
2029
st.markdown("""
21-
### Resource Archive
22-
Use this page to access our shared slide decks and documents.
23-
You can preview files in the browser or download them directly.
30+
Welcome to the central data repository. Use the table below to browse
31+
scientific assets, preview documents, or download them directly.
2432
""")
2533
# --- END HEADER SECTION ---
2634

27-
# 1) SWAP TABS - "Library" is now first (Default)
35+
# 1) SWAP TABS - "View Library" is defined first so it is the default tab
2836
tab1, tab2 = st.tabs(["📚 View Library", "📤 Upload New File"])
2937

3038
with tab1:
31-
# This is placeholder data - replace 'df' with your actual Google Sheets dataframe
39+
# DATA SECTION:
40+
# Replace the 'data' dictionary below with your actual Google Sheets loading logic
41+
# e.g., df = conn.read(spreadsheet="URL_HERE")
3242
data = {
33-
"File Name": ["Sample_Presentation.pptx", "Data_Analysis_v2.xlsx"],
34-
"Description": ["A short description of the file.", "A much longer description that will wrap within the cell to keep the table narrow."],
35-
"View Link": ["https://docs.google.com/spreadsheets/d/1", "https://docs.google.com/spreadsheets/d/2"],
36-
"Download Link": ["https://example.com/file1", "https://example.com/file2"]
43+
"File Name": [
44+
"Molecular_Biology_v1.pptx",
45+
"Chemical_Structures_Final.pdf",
46+
"Lab_Safety_Protocols_2024.docx"
47+
],
48+
"Description": [
49+
"A comprehensive overview of molecular biology foundations including CRISPR sequences.",
50+
"High-resolution renders of organic chemical structures for the Q3 presentation.",
51+
"Updated safety guidelines for all personnel working in the Grade 2 cleanroom environment."
52+
],
53+
"View Link": [
54+
"https://docs.google.com/presentation/d/1",
55+
"https://docs.google.com/viewer?url=example1",
56+
"https://docs.google.com/viewer?url=example2"
57+
],
58+
"Download Link": [
59+
"https://example.com/download/file1",
60+
"https://example.com/download/file2",
61+
"https://example.com/download/file3"
62+
]
3763
}
3864
df = pd.DataFrame(data)
3965

4066
# 2) NARROWER TABLE & WORD WRAP
4167
# 3) TWO LINK COLUMNS
68+
# The 'width' parameter in column_config helps control the 'narrowness' of specific columns
4269
st.dataframe(
4370
df,
4471
column_config={
4572
"File Name": st.column_config.TextColumn("File Name", width="medium"),
46-
"Description": st.column_config.TextColumn("Description", width="large"),
47-
"View Link": st.column_config.LinkColumn("View File", display_text="👁️ View"),
48-
"Download Link": st.column_config.LinkColumn("Download", display_text="📥 Download")
73+
"Description": st.column_config.TextColumn(
74+
"Description",
75+
width="large",
76+
help="Text wraps automatically when you click the cell"
77+
),
78+
"View Link": st.column_config.LinkColumn(
79+
"View File",
80+
display_text="👁️ Open in Sheets"
81+
),
82+
"Download Link": st.column_config.LinkColumn(
83+
"Download",
84+
display_text="📥 Download"
85+
)
4986
},
5087
hide_index=True,
51-
use_container_width=True
88+
use_container_width=True # Ensures the table fills the center layout but respects column widths
5289
)
5390

5491
with tab2:
55-
st.header("Upload Section")
56-
st.write("Upload functionality goes here.")
92+
st.header("Upload New Assets")
93+
st.info("Select a file below to add it to the library.")
94+
uploaded_file = st.file_uploader("Choose a file")
95+
if uploaded_file is not None:
96+
st.success(f"File '{uploaded_file.name}' is ready for processing!")

0 commit comments

Comments
 (0)