|
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") |
|
|
|
|
|
uploaded_file = st.sidebar.file_uploader("Choose a CSV file", type="csv") |
|
|
|
if uploaded_file is not None: |
|
df = load_data(uploaded_file) |
|
|
|
|
|
data_processor = DataProcessor(df) |
|
visualizer = Visualizer() |
|
analyzer = Analyzer() |
|
openai_agent = OpenAIAgent() |
|
time_series_analyzer = TimeSeriesAnalyzer() |
|
ml = MachineLearning() |
|
text_analyzer = TextAnalyzer() |
|
geo_analyzer = GeospatialAnalyzer() |
|
|
|
|
|
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.") |
|
|
|
|
|
st.sidebar.markdown("---") |
|
st.sidebar.info("Developed by Your Company Name") |