Skip to content

Commit 45e68c0

Browse files
authored
Merge pull request #5 from pinin4fjords/use_server_path
Add server path as another loading option
2 parents 99ca542 + e50308f commit 45e68c0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

multiqc_app.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
st.title("MultiQC Streamlit App")
2222
input_method = st.radio(
2323
"Choose input method",
24-
("Load from URL", "Upload File")
24+
("Load from URL", "Upload File", "Server Path")
2525
)
2626

2727
if input_method == "Load from URL":
@@ -40,6 +40,21 @@
4040
if uploaded_file is not None:
4141
st.session_state.bytes_data = uploaded_file.getvalue()
4242
data_url = uploaded_file.name
43+
44+
elif input_method == "Server Path":
45+
st.write("Enter the full path to a MultiQC data ZIP file on the server.")
46+
server_path = st.text_input("Server Path")
47+
if st.button("Load from Server Path"):
48+
try:
49+
with open(server_path, 'rb') as f:
50+
st.session_state.bytes_data = f.read()
51+
data_url = server_path.split('/')[-1] # Get filename from path
52+
except FileNotFoundError:
53+
st.error(f"File not found at path: {server_path}")
54+
st.session_state.bytes_data = None
55+
except Exception as e:
56+
st.error(f"Error reading file from server path: {e}")
57+
st.session_state.bytes_data = None
4358

4459
# Set EXAMPLE_CUSTOM_DATA in an input - Keep in sidebar for editing anytime
4560
EXAMPLE_CUSTOM_DATA = st.text_area(

0 commit comments

Comments
 (0)