File size: 1,772 Bytes
eceebf5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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()