File size: 3,254 Bytes
47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 47cec27 f158d04 |
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 91 92 93 94 95 96 97 98 99 100 101 |
import streamlit as st
import pandas as pd
from data_processor import DataProcessor
from visualizer import Visualizer
from analyzer import Analyzer
from openai_agent import OpenAIAgent
from time_series_analyzer import TimeSeriesAnalyzer
from machine_learning import MachineLearning
from text_analyzer import TextAnalyzer
from geospatial_analyzer import GeospatialAnalyzer
from utils import load_data, save_data
st.set_page_config(page_title="AI-Powered Data Analysis", layout="wide")
st.title("AI-Powered Data Analysis and Visualization")
# File uploader
uploaded_file = st.sidebar.file_uploader("Choose a CSV file", type="csv")
if uploaded_file is not None:
df = load_data(uploaded_file)
# Initialize components
data_processor = DataProcessor(df)
visualizer = Visualizer()
analyzer = Analyzer()
openai_agent = OpenAIAgent()
time_series_analyzer = TimeSeriesAnalyzer()
ml = MachineLearning()
text_analyzer = TextAnalyzer()
geo_analyzer = GeospatialAnalyzer()
# Sidebar for feature selection
feature = st.sidebar.radio(
"Select a feature",
["Data Overview", "Data Cleaning", "Data Visualization", "Data Analysis",
"AI Insights", "Time Series Analysis", "Machine Learning",
"Text Analysis", "Geospatial Analysis", "Custom AI Tasks"]
)
if feature == "Data Overview":
st.header("Data Overview")
st.write("Dataset shape:", df.shape)
st.write("Columns:", df.columns.tolist())
st.write("Sample data:")
st.write(df.head())
if st.checkbox("Show data types"):
st.write(df.dtypes)
if st.checkbox("Show summary statistics"):
st.write(df.describe())
elif feature == "Data Cleaning":
st.header("Data Cleaning and Preprocessing")
df_cleaned = data_processor.clean_data()
st.write("Cleaned data shape:", df_cleaned.shape)
st.write(df_cleaned.head())
if st.button("Save Cleaned Data"):
save_data(df_cleaned, "cleaned_data.csv")
st.success("Cleaned data saved successfully!")
elif feature == "Data Visualization":
st.header("Data Visualization")
visualizer.create_visualizations(df)
elif feature == "Data Analysis":
st.header("Data Analysis")
analyzer.perform_analysis(df)
elif feature == "AI Insights":
st.header("AI-Powered Insights")
openai_agent.generate_insights(df)
elif feature == "Time Series Analysis":
st.header("Time Series Analysis")
time_series_analyzer.analyze(df)
elif feature == "Machine Learning":
st.header("Machine Learning")
ml.perform_ml_tasks(df)
elif feature == "Text Analysis":
st.header("Text Analysis")
text_analyzer.analyze_text(df)
elif feature == "Geospatial Analysis":
st.header("Geospatial Analysis")
geo_analyzer.analyze_geospatial_data(df)
elif feature == "Custom AI Tasks":
st.header("Custom AI Tasks")
openai_agent.custom_ai_task(df)
else:
st.write("Please upload a CSV file to get started.")
# Add a footer
st.sidebar.markdown("---")
st.sidebar.info("Developed by Your Company Name") |