Skip to content

Add server path as another loading option #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion multiqc_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
st.title("MultiQC Streamlit App")
input_method = st.radio(
"Choose input method",
("Load from URL", "Upload File")
("Load from URL", "Upload File", "Server Path")
)

if input_method == "Load from URL":
Expand All @@ -40,6 +40,21 @@
if uploaded_file is not None:
st.session_state.bytes_data = uploaded_file.getvalue()
data_url = uploaded_file.name

elif input_method == "Server Path":
st.write("Enter the full path to a MultiQC data ZIP file on the server.")
server_path = st.text_input("Server Path")
if st.button("Load from Server Path"):
try:
with open(server_path, 'rb') as f:
st.session_state.bytes_data = f.read()
data_url = server_path.split('/')[-1] # Get filename from path
except FileNotFoundError:
st.error(f"File not found at path: {server_path}")
st.session_state.bytes_data = None
except Exception as e:
st.error(f"Error reading file from server path: {e}")
st.session_state.bytes_data = None

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