File size: 4,072 Bytes
b660019
 
2cea047
 
fe9261a
2cea047
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18046f9
2cea047
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import streamlit as st

def intro():
    st.write("# Data Engineers Helper ✨")
    st.sidebar.success("Navigate Here ⏬")

    st.markdown(
        """
        ## Data Engineers Helper 

This project aims to empower data engineers with the assistance of large language models (LLMs). It provides an interactive application where users can perform basic data engineering tasks through prompts and data upload functionalities.

### Key functionalities:

* **Prompt-based Data Manipulation:** Utilize LLMs to automate data manipulation tasks by providing clear prompts. The LLM can understand and generate Python code to perform actions like filtering, aggregation, or transformation on your data.
* **Flexible Data Handling:** Upload various datasets in supported formats (e.g., CSV, Excel) for the LLM to analyze and manipulate based on your prompts.
* **Future: Automating Data Analysis:** We're actively developing an agent similar to AutoGPT, specifically designed for data analysis. This agent will assist users with tasks like:
    * Identifying patterns and trends within datasets.
    * Generating data visualizations based on user queries.
    * Formulating data analysis questions and suggesting appropriate approaches.

### Collaboration Opportunities:

We're open to collaboration with individuals and teams interested in:

* **LLM Integration:** Expertise in integrating LLMs for data engineering tasks is highly valuable.
* **Data Analysis Automation:** Sharing knowledge and collaborating on building the data analysis agent would significantly accelerate its development.
* **Usability Enhancements:** We welcome suggestions to improve the user experience and make the application more intuitive for data engineers.

**By combining LLM capabilities with a user-friendly interface, Data Engineers Helper strives to streamline data engineering workflows and empower users to focus on more complex tasks.**

**Let's work together to revolutionize the way data engineers approach their daily work!  **

**Feel free to reach out if you have any questions or are interested in collaborating on this project.  ✉️**  [Contact us](mailto:xyzash568@gmail.com)


        """
    )

def data_frame_demo():
    from main import datachat as dc
    st.title("Data Engineer's Helper")

    data_file = r"./world_population_data.csv"
    uploaded_file = st.file_uploader("Choose a file")
    # Write the uploaded file to a specific location
    if uploaded_file is not None:
        with open(data_file, "wb") as f:
            f.write(uploaded_file.read())

    chat_object = dc(file_path=data_file)

    # Initialize chat history
    if "messages" not in st.session_state:
        st.session_state.messages = []

    # Display chat messages from history on app rerun
    for message in st.session_state.messages:
        if message["role"] == 'user':
            with st.chat_message(message["role"]):
                st.markdown(message["content"])
        if message["role"] == 'assistant':
            with st.chat_message(message["role"]):
                st.dataframe(message["content"], hide_index=True)

    # React to user input
    if prompt := st.chat_input("What is up?"):
        # Display user message in chat message container
        with st.chat_message("user"):
            st.markdown(prompt)
        # Add user message to chat history
        st.session_state.messages.append({"role": "user", "content": prompt})

        response = chat_object.data_ops(prompt)
        # Display assistant response in chat message container
        with st.chat_message("assistant"):
            st.dataframe(response, hide_index=True)
        # Add assistant response to chat history
        st.session_state.messages.append({"role": "assistant", "content": response})

# Dictionary mapping page names to their respective functions
page_names_to_funcs = {
    "About": intro,
    "Data Engineers Helper": data_frame_demo
}

# Select demo from sidebar
demo_name = st.sidebar.selectbox("Choose a page", page_names_to_funcs.keys())
page_names_to_funcs[demo_name]()