FarrelAD's picture
init project
23ab98a
from typing import Any
import gradio as gr
import pandas as pd
import helpers
# --- Global Variables ---
df = None
# --- Gradio App ---
with gr.Blocks() as demo:
gr.Markdown("# πŸ“Š Datathon Dashboard with Gradio")
with gr.Tab("Dataset Overview"):
file_input = gr.File(label="Upload CSV", file_types=[".csv"])
preview = gr.HTML()
shape = gr.Textbox(label="Dataset Info")
file_input.change(helpers.load_data, inputs=file_input, outputs=[preview, shape])
with gr.Tab("Exploratory Data Analysis"):
gr.Markdown("## πŸ” EDA Section")
col_dropdown = gr.Dropdown(label="Select column to visualize", choices=[], interactive=True)
plot = gr.Plot()
# When file uploaded, update dropdown
def update_dropdown(file) -> dict[str, Any]:
d = pd.read_csv(file.name)
return gr.update(choices=d.columns.tolist())
file_input.change(update_dropdown, inputs=file_input, outputs=col_dropdown)
col_dropdown.change(helpers.plot_column, inputs=col_dropdown, outputs=plot)
with gr.Tab("Modeling (Optional)"):
gr.Markdown("You can add ML model training or predictions here.")
with gr.Tab("Insights"):
gr.Markdown("## πŸ“Œ Insights & Conclusion")
gr.Markdown("Write your story, insights, and recommendations here.")
if __name__ == "__main__":
demo.launch()