├── file2 ├── README.md └── file1 /file2: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import plotly.express as px 3 | from datetime import timedelta 4 | 5 | # Read Excel file (example structure: Task, Start, Duration (days), Assigned To) 6 | df_excel = pd.read_excel("tasks.xlsx") 7 | 8 | # Convert Start to datetime and compute Finish 9 | df_excel["Start"] = pd.to_datetime(df_excel["Start"]) 10 | df_excel["Finish"] = df_excel["Start"] + df_excel["Duration (days)"].apply(lambda x: timedelta(days=int(x))) 11 | 12 | # Gantt Chart 13 | fig = px.timeline(df_excel, x_start="Start", x_end="Finish", y="Task", color="Assigned To", title="Gantt Chart - From Excel") 14 | fig.update_yaxes(categoryorder="total ascending") 15 | fig.show() 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 📅 Gantt Chart Auto-Generation from Task Descriptions 2 | 3 | A Streamlit-powered web app that automatically generates interactive Gantt charts from either natural language task descriptions or structured Excel sheets. Ideal for project managers, data teams, and researchers. 4 | 5 | --- 6 | 7 | ## 🚀 Features 8 | 9 | - ✅ Parse tasks from Excel or structured descriptions 10 | - ✅ Support for natural language inputs (e.g. “Alice will collect data from April 1 for 5 days”) 11 | - ✅ Gantt chart generation using Plotly 12 | - ✅ Task dependencies & critical path visualization 13 | - ✅ Track task progress with completion percentages 14 | - ✅ Export charts as HTML or PDF 15 | - ✅ Clean UI built with Streamlit 16 | 17 | --- 18 | 19 | ## 🛠️ Installation 20 | 21 | Clone this repo and install dependencies: 22 | 23 | ```bash 24 | git clone https://github.com/Akajiaku1/gantt-chart-generator.git 25 | cd gantt-chart-generator 26 | pip install -r requirements.txt 27 | -------------------------------------------------------------------------------- /file1: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import plotly.express as px 3 | import re 4 | from datetime import datetime, timedelta 5 | 6 | # Step 1: Synthetic Task Descriptions 7 | task_descriptions = [ 8 | "Task: Data Collection, Start: 2025-04-01, Duration: 5 days, Assigned to: Alice", 9 | "Task: Data Cleaning, Start: 2025-04-06, Duration: 3 days, Assigned to: Bob", 10 | "Task: Feature Engineering, Start: 2025-04-09, Duration: 4 days, Assigned to: Alice", 11 | "Task: Model Training, Start: 2025-04-13, Duration: 7 days, Assigned to: Carol", 12 | "Task: Evaluation & Testing, Start: 2025-04-20, Duration: 3 days, Assigned to: Bob", 13 | "Task: Report Generation, Start: 2025-04-23, Duration: 2 days, Assigned to: Alice" 14 | ] 15 | 16 | # Step 2: Parse Descriptions into Structured Data 17 | def parse_description(desc): 18 | task_match = re.search(r"Task:\s*(.*?),", desc) 19 | start_match = re.search(r"Start:\s*([\d\-]+),", desc) 20 | duration_match = re.search(r"Duration:\s*(\d+)\s*days", desc) 21 | person_match = re.search(r"Assigned to:\s*(\w+)", desc) 22 | 23 | task = task_match.group(1).strip() 24 | start = datetime.strptime(start_match.group(1), "%Y-%m-%d") 25 | duration = int(duration_match.group(1)) 26 | end = start + timedelta(days=duration) 27 | person = person_match.group(1) 28 | 29 | return { 30 | "Task": task, 31 | "Start": start, 32 | "Finish": end, 33 | "Assigned To": person 34 | } 35 | 36 | task_data = [parse_description(desc) for desc in task_descriptions] 37 | df_tasks = pd.DataFrame(task_data) 38 | 39 | # Step 3: Generate Gantt Chart 40 | fig = px.timeline(df_tasks, x_start="Start", x_end="Finish", y="Task", color="Assigned To", title="Gantt Chart - Auto Generated from Descriptions") 41 | fig.update_yaxes(categoryorder="total ascending") 42 | fig.show() 43 | --------------------------------------------------------------------------------