Darpan07 commited on
Commit
3c06087
·
verified ·
1 Parent(s): 3fab904

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +90 -28
app.py CHANGED
@@ -6,10 +6,15 @@ import pandas as pd
6
  import base64
7
  from Functions import RFPProcessor
8
  # from localStoragePy import localStoragePy
9
- from Utils import export,clear_rfp_data, generate_roadmap_image
 
 
 
 
 
10
  # from Login_and_email import *
11
-
12
- # localStorage = localStoragePy("RFP", "json")
13
 
14
  # Initialize session states
15
  if "generated" not in st.session_state:
@@ -46,7 +51,9 @@ if "roadmap_data_json" not in st.session_state:
46
  st.session_state["roadmap_data_json"] = []
47
  if "is_roadmap_data_created" not in st.session_state:
48
  st.session_state["is_roadmap_data_created"] = False
49
-
 
 
50
 
51
  def main():
52
  function = RFPProcessor()
@@ -57,7 +64,15 @@ def main():
57
  with st.sidebar:
58
  menu_choice = option_menu(
59
  menu_title="RFPStoryCraft",
60
- options=["Home", "RFP Bot", "User Stories", "Summary", "Estimations","RoadMap"],
 
 
 
 
 
 
 
 
61
  icons=["house", "list-task", "book", "book", "list-task"],
62
  )
63
 
@@ -75,7 +90,9 @@ def main():
75
  type="default",
76
  placeholder="Project Name",
77
  )
78
- file = st.file_uploader("Document", type="pdf")
 
 
79
 
80
  submitted = st.form_submit_button("Process Data")
81
 
@@ -116,10 +133,13 @@ def main():
116
  on_click=function.genrate_user_stories,
117
  )
118
  if st.session_state["is_user_stories_created"] == True:
119
- st.button("Export Stories", on_click=lambda: export(st.session_state["user_stories_data"]))
 
 
 
120
  with st.container():
121
- df = pd.DataFrame(st.session_state["user_stories_data"])
122
- st.table(df)
123
  else:
124
  st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
125
 
@@ -147,21 +167,35 @@ def main():
147
  label="Number of Tech Leads",
148
  placeholder="Enter here....",
149
  )
150
-
151
- if senior_developers and junior_developers and tech_leads and st.session_state["is_user_stories_created"] == True:
 
 
 
 
 
152
  st.button(
153
  "Generate Estimations",
154
- on_click=lambda: function.generate_estimations(tech_leads, senior_developers, junior_developers),
 
 
155
  )
156
-
157
- if st.session_state["is_estimation_data_created"] == True:
158
  if st.session_state["is_estimation_data_created"] == True:
159
- st.button("Export Stories", on_click = lambda: export(st.session_state["estimation_data"]))
160
- with st.container():
161
- df = pd.DataFrame(st.session_state["estimation_data"])
162
- st.table(df)
 
 
 
 
 
 
163
  else:
164
- st.warning("Plesase Process User Stories to access this feature", icon="⚠️")
 
 
165
  else:
166
  st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
167
 
@@ -179,10 +213,10 @@ def main():
179
  on_click=lambda: export(st.session_state["roadmap_data"]),
180
  )
181
  if st.button("Generate Roadmap and Download"):
182
- st.info("Generating roadmap... Please wait.")
183
- # Generate the roadmap image
184
- generate_roadmap_image()
185
-
186
  with st.container():
187
  df = pd.DataFrame(st.session_state["roadmap_data"])
188
  st.table(df)
@@ -194,10 +228,38 @@ def main():
194
  )
195
  else:
196
  st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
197
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
  if __name__ == "__main__":
200
- # if localStorage.getItem("email"):
201
- main()
202
- # else:
203
- # authenticate(localStorage)
 
6
  import base64
7
  from Functions import RFPProcessor
8
  # from localStoragePy import localStoragePy
9
+ from Utils import (
10
+ export,
11
+ clear_rfp_data,
12
+ get_binary_file_downloader_html,
13
+ generate_roadmap_image,
14
+ )
15
  # from Login_and_email import *
16
+ from Proposal import prop
17
+ #localStorage = localStoragePy("RFP", "json")
18
 
19
  # Initialize session states
20
  if "generated" not in st.session_state:
 
51
  st.session_state["roadmap_data_json"] = []
52
  if "is_roadmap_data_created" not in st.session_state:
53
  st.session_state["is_roadmap_data_created"] = False
54
+ if "is_presentation_created" not in st.session_state:
55
+ st.session_state["is_presentation_created"] = False
56
+
57
 
58
  def main():
59
  function = RFPProcessor()
 
64
  with st.sidebar:
65
  menu_choice = option_menu(
66
  menu_title="RFPStoryCraft",
67
+ options=[
68
+ "Home",
69
+ "RFP Bot",
70
+ "User Stories",
71
+ "Summary",
72
+ "Estimations",
73
+ "RoadMap",
74
+ "Proposal",
75
+ ],
76
  icons=["house", "list-task", "book", "book", "list-task"],
77
  )
78
 
 
90
  type="default",
91
  placeholder="Project Name",
92
  )
93
+ file = st.file_uploader(
94
+ "Document", type=["pdf", "txt", "docx"], accept_multiple_files=False
95
+ )
96
 
97
  submitted = st.form_submit_button("Process Data")
98
 
 
133
  on_click=function.genrate_user_stories,
134
  )
135
  if st.session_state["is_user_stories_created"] == True:
136
+ st.button(
137
+ "Export Stories",
138
+ on_click=lambda: export(st.session_state["user_stories_data"]),
139
+ )
140
  with st.container():
141
+ df = pd.DataFrame(st.session_state["user_stories_data"])
142
+ st.table(df)
143
  else:
144
  st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
145
 
 
167
  label="Number of Tech Leads",
168
  placeholder="Enter here....",
169
  )
170
+
171
+ if (
172
+ senior_developers
173
+ and junior_developers
174
+ and tech_leads
175
+ and st.session_state["is_user_stories_created"] == True
176
+ ):
177
  st.button(
178
  "Generate Estimations",
179
+ on_click=lambda: function.generate_estimations(
180
+ tech_leads, senior_developers, junior_developers
181
+ ),
182
  )
183
+
 
184
  if st.session_state["is_estimation_data_created"] == True:
185
+ st.button(
186
+ "Export Stories",
187
+ on_click=lambda: export(
188
+ st.session_state["estimation_data"]
189
+ ),
190
+ )
191
+
192
+ with st.container():
193
+ df = pd.DataFrame(st.session_state["estimation_data"])
194
+ st.table(df)
195
  else:
196
+ st.warning(
197
+ "Plesase Process User Stories to access this feature", icon="⚠️"
198
+ )
199
  else:
200
  st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
201
 
 
213
  on_click=lambda: export(st.session_state["roadmap_data"]),
214
  )
215
  if st.button("Generate Roadmap and Download"):
216
+ st.info("Generating roadmap... Please wait.")
217
+ # Generate the roadmap image
218
+ generate_roadmap_image()
219
+
220
  with st.container():
221
  df = pd.DataFrame(st.session_state["roadmap_data"])
222
  st.table(df)
 
228
  )
229
  else:
230
  st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
231
+
232
+ if menu_choice == "Proposal":
233
+ if st.session_state["is_data_processed"] == True:
234
+ if st.session_state["is_user_stories_created"] == True:
235
+ st.title("Proposal")
236
+ num_slides = st.number_input(
237
+ "Enter the number of slides", min_value=1, max_value=20, value=None
238
+ )
239
+ if num_slides:
240
+ st.button(
241
+ "Generate Presentation", on_click=lambda: prop(num_slides)
242
+ )
243
+
244
+ if st.session_state["is_presentation_created"] == True:
245
+ st.success("Presentation Created!", icon="✅")
246
+ with open("Generated_Presentation.pptx", "rb") as pptx_file:
247
+ pptx_bytes = pptx_file.read()
248
+ st.download_button(
249
+ label="Download Presentation",
250
+ data=pptx_bytes,
251
+ file_name="Generated_Presentation_from_code.pptx",
252
+ mime="application/vnd.openxmlformats-officedocument.presentationml.presentation",
253
+ )
254
+
255
+ else:
256
+ st.warning(
257
+ "Please Process the User Stories Data to access this feature",
258
+ icon="⚠️",
259
+ )
260
+ else:
261
+ st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
262
+
263
 
264
  if __name__ == "__main__":
265
+ main()