mpi_data_store / pages /data_source_config.py
rianders's picture
added pages
eceebf5
raw
history blame
No virus
1.77 kB
import streamlit as st
import os
def main():
st.title("Data Source Configuration")
# Explanation or introduction
st.write("Configure the source from which to mine data, including the GitHub repository and the output directory for storing generated data.")
# Repository selection
repo_url = st.text_input("GitHub Repository URL", "https://github.com/username/repository")
# Validate the URL (basic validation for demonstration)
if "github.com" not in repo_url:
st.error("Please enter a valid GitHub repository URL.")
else:
# Assuming validation passed, store the repo URL in session state or proceed with further processing
st.session_state['repo_url'] = repo_url
st.success("Repository URL saved.")
# Output directory selection
default_dir = os.path.join(".", "output_data") # Default directory path
out_dir = st.text_input("Output Directory for Generated Data", value=default_dir)
# Directory existence check (Create if doesn't exist)
if st.button("Save Output Directory"):
try:
os.makedirs(out_dir, exist_ok=True) # Create the directory if it does not exist
st.session_state['output_dir'] = out_dir
st.success(f"Output directory set to: {out_dir}")
except Exception as e:
st.error(f"Failed to create the directory: {str(e)}")
# Optional: Provide navigation or action buttons
# For example, a button to proceed to the next step if this page's task is completed
if st.button("Proceed to Data Loading"):
# Change the page in the session state, assuming you have set up session-based navigation in app.py
st.session_state.page = 'data_loading'
if __name__ == "__main__":
main()