Umar4321 commited on
Commit
87d2502
·
verified ·
1 Parent(s): 0367713

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +79 -0
app.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import plotly.express as px
4
+ from io import BytesIO
5
+
6
+ # Page configuration
7
+ st.set_page_config(page_title="Research Gantt Chart", layout="wide")
8
+
9
+ # Title and description
10
+ st.title("📊 Research Proposal Gantt Chart")
11
+ st.markdown("""
12
+ This Gantt chart outlines the 10-month timeline for your research project:
13
+ **Critical Evaluation of ASME Section VIII Rules for Nozzle Reinforcement and Placement**
14
+ Each phase is color-coded and aligned with your methodology for formal presentation.
15
+ """)
16
+
17
+ # Define task data
18
+ tasks = [
19
+ {"Phase": "Literature Review", "Start": 1, "End": 2, "Color": "SteelBlue"},
20
+ {"Phase": "UG-37 Calculations", "Start": 2, "End": 3, "Color": "SlateGray"},
21
+ {"Phase": "Finite Element Analysis (FEA)", "Start": 3, "End": 6, "Color": "DarkOrange"},
22
+ {"Phase": "Comparative Study", "Start": 6, "End": 7, "Color": "Teal"},
23
+ {"Phase": "Recommendations", "Start": 7, "End": 8, "Color": "Olive"},
24
+ {"Phase": "Thesis & Journal Prep", "Start": 8, "End": 9, "Color": "Navy"},
25
+ {"Phase": "Buffer Month", "Start": 10, "End": 10.5, "Color": "LightGray"},
26
+ ]
27
+
28
+ df = pd.DataFrame(tasks)
29
+ df["Duration"] = df["End"] - df["Start"]
30
+
31
+ # Create Gantt chart
32
+ fig = px.timeline(
33
+ df,
34
+ x_start="Start",
35
+ x_end="End",
36
+ y="Phase",
37
+ color="Phase",
38
+ color_discrete_map={row["Phase"]: row["Color"] for row in tasks},
39
+ title="Gantt Chart: ASME Nozzle Reinforcement Study",
40
+ )
41
+
42
+ # Customize layout
43
+ fig.update_layout(
44
+ xaxis_title="Month",
45
+ yaxis_title="Research Phase",
46
+ title_font=dict(size=22, family="Segoe UI"),
47
+ font=dict(size=14),
48
+ showlegend=False,
49
+ margin=dict(l=40, r=40, t=80, b=40),
50
+ height=650,
51
+ xaxis=dict(
52
+ tickmode="linear",
53
+ tick0=1,
54
+ dtick=1,
55
+ range=[0.5, 11],
56
+ title_font=dict(size=16),
57
+ ),
58
+ yaxis=dict(
59
+ title_font=dict(size=16),
60
+ )
61
+ )
62
+
63
+ # Display chart
64
+ st.plotly_chart(fig, use_container_width=True)
65
+
66
+ # Export chart as PNG
67
+ st.markdown("### 📥 Export Chart for Presentation")
68
+ buffer = BytesIO()
69
+ fig.write_image(buffer, format="png", width=1600, height=900)
70
+ st.download_button(
71
+ label="Download High-Resolution PNG",
72
+ data=buffer.getvalue(),
73
+ file_name="ASME_Research_Gantt_Chart.png",
74
+ mime="image/png"
75
+ )
76
+
77
+ # Optional footer
78
+ st.markdown("---")
79
+ st.caption("Designed by Muhammad | Powered by Streamlit & Plotly")