Spaces:
Sleeping
Sleeping
import pandas as pd | |
import streamlit.components.v1 as components | |
import streamlit as st | |
from ydata_profiling import ProfileReport | |
from streamlit_pandas_profiling import st_profile_report | |
from langchain.llms.openai import OpenAI | |
from langchain_experimental.agents import create_csv_agent | |
from langchain.agents.agent_types import AgentType | |
import time | |
import os | |
from mitosheet.streamlit.v1 import spreadsheet | |
from pygwalker.api.streamlit import init_streamlit_comm, get_streamlit_html | |
st.set_page_config( | |
page_title="AI TOOL", | |
layout="wide" | |
) | |
def main(): | |
st.sidebar.title("App Options") | |
option = st.sidebar.selectbox("Choose an option", ["View Instructions", "View Data","Data Profiling","Tableau AI", "CSV Chatbot"]) | |
if option == "View Instructions": | |
show_instructions() | |
elif option == "Data Profiling": | |
uploaded_file = st.file_uploader("Upload CSV file", type=["csv"]) | |
if uploaded_file is None: | |
st.warning("Please upload a CSV file.") | |
st.stop() # Stop execution if no file uploaded | |
else: | |
data_profiling(uploaded_file) | |
elif option == "CSV Chatbot": | |
openai_api_key = st.text_input("Enter your OpenAI API Key", type="password") | |
if not openai_api_key: | |
st.warning("You should have an OpenAI API key to continue. Get one at [OpenAI API Keys](https://platform.openai.com/api-keys)") | |
st.stop() | |
os.environ['OPENAI_API_KEY'] = openai_api_key | |
personal_assistant() | |
elif option == "View Data": | |
virtual_excel_sheet() | |
elif option == "Tableau AI": | |
tableau_ai() | |
def show_instructions(): | |
st.title("Welcome to the AI TOOL!") | |
st.write("This tool offers several functionalities to help you analyze and work with your data.") | |
st.write("Please select an option from the sidebar to proceed:") | |
st.write("- **View Data:** Upload a CSV file and view its contents.") | |
st.write("- **Data Profiling:** Upload a CSV file to generate a data profiling report.") | |
st.write("- **CSV Chatbot:** Interact with a chatbot to get insights from your CSV data.") | |
st.write("- **Tableau AI:** Upload a CSV file to visualize it using Tableau AI.") | |
st.write("- **View Instructions:** View these instructions again.") | |
def data_profiling(uploaded_file): | |
st.title("Data Profiling App") | |
# Load the data | |
df = pd.read_csv(uploaded_file) | |
# Display the dataframe | |
st.dataframe(df) | |
# Generate and display the data profile report | |
pr = ProfileReport(df, title="Report") | |
st_profile_report(pr) | |
# Define other functions (personal_assistant, virtual_excel_sheet, tableau_ai) as before... | |
if __name__ == "__main__": | |
main() | |