Darpan07 commited on
Commit
1980540
·
verified ·
1 Parent(s): 12984b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +97 -408
app.py CHANGED
@@ -1,32 +1,15 @@
1
-
2
- import json
3
- import base64
4
  import os
5
- import re
6
-
7
- import streamlit as st
8
- from langchain.llms import OpenAI
9
- from langchain import PromptTemplate
10
- from langchain.chains import LLMChain
11
- from langchain.llms import OpenAI
12
- from PyPDF2 import PdfReader
13
  import streamlit as st
14
  from streamlit_option_menu import option_menu
15
- from langchain.text_splitter import CharacterTextSplitter
16
- from langchain_community.vectorstores import Chroma
17
- from langchain_community.embeddings import OpenAIEmbeddings
18
  import pandas as pd
19
- from streamlit_oauth import OAuth2Component
20
- from localStoragePy import localStoragePy
21
-
22
- localStorage = localStoragePy('rfpapp', 'json')
23
-
24
-
25
- openai_api_key = os.environ.get('OPENAI_API_KEY')
26
- CLIENT_ID = os.environ.get("CLIENT_ID")
27
- CLIENT_SECRET = os.environ.get("CLIENT_SECRET")
28
- REDIRECT_URI = os.environ.get("REDIRECT_URI")
29
 
 
30
 
31
  # Initialize session states
32
  if "generated" not in st.session_state:
@@ -43,432 +26,138 @@ if "is_data_processed" not in st.session_state:
43
  st.session_state["is_data_processed"] = False
44
  if "user_stories" not in st.session_state:
45
  st.session_state["user_stories"] = ""
 
 
46
  if "user_stories_json" not in st.session_state:
47
- st.session_state["user_stories_json"] = []
48
  if "is_user_stories_created" not in st.session_state:
49
  st.session_state["is_user_stories_created"] = False
50
  if "rfp_summary" not in st.session_state:
51
  st.session_state["rfp_summary"] = ""
52
-
53
-
54
- bot_template = """As a highly intelligent and powerful chatbot, your personality is a business analyst's responsibility.
55
- Your designated name is RFP Bot. Initiate the conversation with a warm greeting only when the user asks something for the first time. Subsequent interactions can skip the greeting.
56
- Your generated responses should be comprehensive, utilizing pointers when necessary for an enhanced user experience. Provide detailed answers, and if the user's input isn't related to personality, respond politely with an apology, encouraging them to ask questions related to your established personality. Keep your responses concise and accurate, seeking additional information from the user when required.
57
- Incorporate the provided context and any relevant information from the chat history into your responses. If the user's input is related to the context or question, articulate your answer accordingly.
58
- {context}
59
- Human: {input}
60
- Assistant:"""
61
-
62
- # user_story_template = """Given the project details with the following parameters:
63
-
64
- # **Project Name:** {project_name}
65
-
66
- # **RFP details:**
67
- # {rfp_details}
68
-
69
- # As a business analyst, analyze the given RFP details to delineate epics for the project. Break down the epics into features and features into individual requirements, adhering to the agile software development INVEST principles. Subsequently, generate user stories for each requirement. Ensure each story follows the "As a, I want to, So that" format and strictly avoid combining stories together.
70
-
71
- # **Examples**
72
-
73
- # 1. Epic: User Authentication and Account Security Enhancements
74
-
75
- # 1. Feature 1: User Registration
76
- # - Story 1:
77
- # - As a user, I want to provide my basic information, such as name and email address during sign-up, so that the platform can create a personalized account for me.
78
- # - Story 2:
79
- # - As a user, I want the sign-up form to include a CAPTCHA verification step, so that the system can prevent automated bots from creating fake accounts.
80
- # - Story 3:
81
- # - As a user, I want the sign-up form to include optional fields for additional profile information, so that I can customize my account based on my interests.
82
- # - Story 4:
83
- # - As a user, I want the platform to clearly communicate its data usage and privacy policy during the sign-up process, so that I can make an informed decision before creating an account.
84
-
85
- # 2. Feature 2: User Authentication
86
- # - Story 1:
87
- # - As a registered user, I want to log in securely with my credentials, so that I can access personalized account information.
88
- # - Story 2:
89
- # - As a registered user, I want the login page to feature a "Forgot Password" link, so that I can easily initiate the password recovery process if needed.
90
- # - Story 3:
91
- # - As a user concerned about account security, I want the platform to send a notification email whenever my account is accessed from a new device, so that I can be aware of any potential unauthorized access.
92
- # - Story 4:
93
- # - As a returning user, I want the option to enable two-factor authentication (2FA) for an extra layer of security during the login process, so that my account remains protected.
94
- # - Story 5:
95
- # - As a user striving for a seamless experience, I want the platform to offer a "Stay Logged In" option during login, so that I don't have to enter my credentials every time I revisit the site.
96
- # - Story 6:
97
- # - As a user with multiple devices, I want the ability to log out remotely from any active sessions through the account settings, so that I can maintain control over my account access.
98
-
99
- # 3. Feature 3: Account Security Enhancements
100
- # - Story 1:
101
- # - As a security-conscious user, I want the platform to regularly prompt me to update my password and provide guidance on creating a secure password to enhance the overall security of my account.
102
- # - Story 2:
103
- # - As a user who values privacy, I want the platform to automatically log me out after a period of inactivity, ensuring that my account is secure even if I forget to log out manually.
104
- # - Story 3:
105
- # - As a user concerned about account recovery, I want the platform to offer multiple secure account recovery options, such as email verification and phone number verification, to ensure I can regain access to my account if needed.
106
- # """
107
-
108
- user_story_template = """Given the project details with the following parameters:
109
-
110
- **Project Name:** {project_name}
111
-
112
- **RFP details:**
113
- {rfp_details}
114
-
115
- As a business analyst, analyze the given RFP details to delineate epics for the project. Break down the epics into features and features into individual requirements, adhering to the agile software development INVEST principles (where I refers to Independent (not dependent on other work deliverables), N refers to Negotiable (allows for best practices), V refers to valuable (provides working functionality), E refers to Estimable (allows clear work estimates), S refers to Small (sized for the team's sprint), T refers to Testable (can be measured to ensure it meets customer expectations)). Subsequently, generate user stories for each requirement. Ensure each story follows the "As a, I want to, So that" format and strictly avoid combining stories together.
116
-
117
- **Examples**
118
-
119
- 1. Epic: User Authentication and Account Security Enhancements
120
-
121
- 1. Feature 1: User Registration
122
- - Story 1:
123
- - As a user, I want to provide my basic information, such as name and email address during sign-up, so that the platform can create a personalized account for me.
124
- - Story 2:
125
- - As a user, I want the sign-up form to include a CAPTCHA verification step, so that the system can prevent automated bots from creating fake accounts.
126
- - Story 3:
127
- - As a user, I want the sign-up form to include optional fields for additional profile information, so that I can customize my account based on my interests.
128
- - Story 4:
129
- - As a user, I want the platform to clearly communicate its data usage and privacy policy during the sign-up process, so that I can make an informed decision before creating an account.
130
-
131
- 2. Feature 2: User Authentication
132
- - Story 1:
133
- - As a registered user, I want to log in securely with my credentials, so that I can access personalized account information.
134
- - Story 2:
135
- - As a registered user, I want the login page to feature a "Forgot Password" link, so that I can easily initiate the password recovery process if needed.
136
- - Story 3:
137
- - As a user concerned about account security, I want the platform to send a notification email whenever my account is accessed from a new device, so that I can be aware of any potential unauthorized access.
138
- - Story 4:
139
- - As a returning user, I want the option to enable two-factor authentication (2FA) for an extra layer of security during the login process, so that my account remains protected.
140
- - Story 5:
141
- - As a user striving for a seamless experience, I want the platform to offer a "Stay Logged In" option during login, so that I don't have to enter my credentials every time I revisit the site.
142
- - Story 6:
143
- - As a user with multiple devices, I want the ability to log out remotely from any active sessions through the account settings, so that I can maintain control over my account access.
144
-
145
- 3. Feature 3: Account Security Enhancements
146
- - Story 1:
147
- - As a security-conscious user, I want the platform to prompt me every 15 days to update my password and provide guidance on creating a secure password to enhance the overall security of my account.
148
- - Story 2:
149
- - As a user who values privacy, I want the platform to automatically log me out after 5 minutes of inactivity, ensuring that my account is secure even if I forget to log out manually.
150
- - Story 3:
151
- - As a user concerned about account recovery, I want the platform to offer email verification and phone number verification account recovery options, to ensure I can regain access to my account if needed.
152
- """
153
-
154
- summary_template = """Given the project details with the following parameters:
155
-
156
- **Project Name:** {project_name}
157
-
158
- **RFP details:**
159
- {rfp_details}
160
-
161
- As a business analyst, analyze the given RFP details and give the detailed summary of the project.
162
-
163
- """
164
-
165
- convert_json_template = """
166
- Given the project user stories:
167
-
168
- **user_stories:** {user_stories}
169
-
170
- Create a JSON representation that captures the structure and details of each epic and feature, including their respective stories. Ensure that the JSON format is well-organized, with clear hierarchies for epic,features and stories.
171
-
172
- Example structure:
173
-
174
- {json_structure}
175
- """
176
-
177
- json_structure = {
178
- "epics": [
179
- {
180
- "name": "App Performance and Efficiency",
181
- "features": [
182
- {
183
- "name": "Fast and Zero Load Time",
184
- "stories": [
185
- {
186
- "name": "Story 1",
187
- "description": "As a user, I want the app to load quickly with zero load time, so that I can access news content efficiently."
188
- },
189
- {
190
- "name": "Story 2",
191
- "description": "As a user, I want the installation process of the mobile app to be quick and hassle-free, so that I can start using the app immediately after download without any complications."
192
- }
193
- ]
194
- }
195
- ]
196
- }
197
- ]
198
- }
199
-
200
-
201
- #function to create a new rfp and clear the existing rfp data
202
-
203
- def clear_rfp_data():
204
- st.session_state.clear()
205
-
206
- #function to logout user from app
207
-
208
- def log_out_user():
209
- st.session_state.clear()
210
- localStorage.clear()
211
- st.rerun()
212
-
213
- #function to validate the email
214
 
215
- def validate_email(email):
216
- # Define the pattern for the company email
217
- pattern = r'^[a-zA-Z]+@coffeebeans\.io$'
218
-
219
- # Use the re.match function to check if the email matches the pattern
220
- match = re.match(pattern, email)
221
-
222
- # Return True if there is a match, indicating a valid email
223
- return match is not None
224
-
225
-
226
- # rfp summary creater
227
-
228
- summary_prompt = PromptTemplate(
229
- input_variables=["project_name", "rfp_details"],
230
- template=summary_template
231
- )
232
-
233
- summary_chain = LLMChain(
234
- llm=OpenAI(model_name='gpt-3.5-turbo-16k', temperature=0.7,
235
- api_key= openai_api_key),
236
- prompt=summary_prompt,
237
- verbose="true",
238
- )
239
-
240
- # process rfp data from pdf file
241
-
242
- def process_rfp_data(project_name, file):
243
- if project_name and file:
244
- loader = PdfReader(file)
245
- for i, page in enumerate(loader.pages):
246
- content = page.extract_text()
247
- if content:
248
- temp = st.session_state["rfp_details"]
249
- st.session_state["rfp_details"] = temp+content
250
- text_splitter = CharacterTextSplitter(
251
- separator='\n', chunk_size=1000, chunk_overlap=150, length_function=len)
252
- texts = text_splitter.split_text(
253
- st.session_state["rfp_details"])
254
- st.session_state["vectorstore"] = Chroma().from_texts(texts, embedding=OpenAIEmbeddings(
255
- openai_api_key=openai_api_key))
256
- st.session_state.project_name = project_name
257
- st.session_state["rfp_summary"] = summary_chain.run(
258
- {"project_name": st.session_state["project_name"], "rfp_details": st.session_state["rfp_details"]})
259
- st.session_state["is_data_processed"] = True
260
- st.success('data processed sucessfully')
261
-
262
-
263
- # genrate bot conversastion
264
-
265
- bot_prompt = PromptTemplate(
266
- input_variables=["context", "input"],
267
- template=bot_template
268
- )
269
-
270
- bot_chain = LLMChain(
271
- llm=OpenAI(model_name='gpt-3.5-turbo-16k', temperature=0.7,
272
- api_key= openai_api_key),
273
- prompt=bot_prompt,
274
- verbose="true",
275
- )
276
-
277
-
278
- def genrate_bot_result():
279
- if len(st.session_state["input"]) > 0:
280
- db = st.session_state["vectorstore"]
281
- context = db.similarity_search(st.session_state["input"])
282
- inputs = {
283
- "context": context[0].page_content,
284
- "input": st.session_state["input"]
285
- }
286
- output = bot_chain.run(inputs)
287
- st.session_state.past.append(st.session_state["input"])
288
- st.session_state.generated.append(output)
289
- st.session_state["input"] = ""
290
-
291
-
292
- # genrate user stories user_story_template = """
293
-
294
- user_story_prompt = PromptTemplate(
295
- input_variables=["project_name", "rfp_details"],
296
- template=user_story_template
297
- )
298
-
299
- user_story_chain = LLMChain(
300
- llm=OpenAI(model_name='gpt-3.5-turbo-16k', temperature=0.7,
301
- api_key= openai_api_key),
302
- prompt=user_story_prompt,
303
- verbose="true",
304
- )
305
-
306
- # prompt template for json
307
-
308
- json_prompt_template = PromptTemplate(
309
- input_variables=["user_stories", "json_structure"],
310
- template=convert_json_template
311
- )
312
-
313
- json_chain = LLMChain(
314
- llm=OpenAI(model_name='gpt-3.5-turbo-16k', temperature=0.7,
315
- api_key= openai_api_key),
316
- prompt=json_prompt_template,
317
- verbose="true",
318
- )
319
-
320
-
321
- def genrate_user_stories():
322
- output = user_story_chain.run(
323
- {"project_name": st.session_state["project_name"], "rfp_details": st.session_state["rfp_details"]})
324
- st.session_state["user_stories"] = output
325
-
326
- json_response = json_chain.run(
327
- {"user_stories": st.session_state["user_stories"], "json_structure": json_structure})
328
-
329
- user_stories_data = json.loads(json_response)
330
-
331
- for epic_data in user_stories_data['epics']:
332
- epic = epic_data["name"]
333
- for feature_data in epic_data['features']:
334
- feature = feature_data["name"]
335
- for story in feature_data["stories"]:
336
- st.session_state.user_stories_json.append(
337
- {"epic": epic, "Feature": feature, "Story Description": story["description"]})
338
- st.session_state["is_user_stories_created"] = True
339
-
340
-
341
- def genrate_technical_stories():
342
- print('genrate technical stories calling')
343
-
344
-
345
- def export_stories():
346
- data_df = pd.DataFrame(st.session_state["user_stories_json"])
347
- csv_data = data_df.to_csv(index=False)
348
- b64 = base64.b64encode(csv_data.encode()).decode()
349
- href = f'<a href="data:file/csv;base64,{b64}" download="data.csv">Download CSV File</a>'
350
- st.markdown(href, unsafe_allow_html=True)
351
- print('generate technical stories calling')
352
-
353
 
354
  def main():
 
 
355
  if "input" not in st.session_state:
356
  st.session_state["input"] = ""
357
 
358
  with st.sidebar:
359
- menu_choice = option_menu(menu_title="RFPStoryCraft", options=[
360
- 'Home', 'RFP Bot', 'User Stories', "Summary"], icons=['house','list-task', 'book', 'book'])
 
 
 
 
361
  if st.session_state["is_data_processed"] == True:
362
- st.button('Clear RFP Data', on_click=clear_rfp_data)
363
- if localStorage.getItem('email'):
364
- st.button('Log out', on_click=log_out_user)
365
 
366
- if menu_choice == 'Home':
 
 
 
367
  with st.form("my_form"):
368
- project_name = st.text_input('Project Name', key='Project Name',
369
- type="default", placeholder='Project Name')
370
- file = st.file_uploader('Document', type='pdf')
 
 
 
 
371
 
372
  submitted = st.form_submit_button("Process Data")
373
 
374
  if submitted:
375
  if project_name and file:
376
- process_rfp_data(project_name, file)
377
  else:
378
  st.warning(
379
- 'project_name and file are required to create create stories', icon="⚠️")
 
 
380
 
381
- if menu_choice == 'RFP Bot':
382
  if st.session_state["is_data_processed"] == True:
383
  st.title(" RFP Chatbot ")
384
  st.subheader(" Powered by Coffeebeans")
385
- st.text_input("You: ", st.session_state["input"], key="input",
386
- placeholder="Your AI assistant here! Ask me Queries related to RFP",
387
- on_change=genrate_bot_result(),
388
- label_visibility='hidden')
 
 
 
 
389
  with st.container():
390
- for i in range(len(st.session_state['generated'])-1, -1, -1):
391
  st.success(st.session_state["generated"][i], icon="🤖")
392
  st.info(st.session_state["past"][i], icon="🧐")
393
  else:
394
- st.warning(
395
- 'Plesase Process RFP Details to access this feature', icon="⚠️")
396
 
397
- if menu_choice == 'User Stories':
398
  if st.session_state["is_data_processed"] == True:
399
  st.title("User Stories")
400
- st.button("Genrate User Stories", type="primary",
401
- on_click=genrate_user_stories)
 
 
 
402
  if st.session_state["is_user_stories_created"] == True:
403
- st.button("Genrate technical Stories", type="primary",
404
- on_click=genrate_technical_stories)
405
- st.button("Export Stories", on_click=export_stories)
406
- with st.container():
407
- df = pd.DataFrame(st.session_state["user_stories_json"])
408
- st.table(df)
409
  else:
410
- st.warning(
411
- 'Plesase Process RFP Details to access this feature', icon="⚠️")
412
 
413
- if menu_choice == 'Summary':
414
  if st.session_state["is_data_processed"] == True:
415
  st.title("Summary")
416
  with st.container():
417
  st.markdown(st.session_state["rfp_summary"])
418
  else:
419
- st.warning(
420
- 'Plesase Process RFP Details to access this feature', icon="⚠️")
421
 
422
- if __name__ == "__main__":
423
- main()
424
-
425
- # if __name__ == "__main__":
426
- # print(localStorage.getItem('email'))
427
- # if localStorage.getItem('email'):
428
- # main()
429
- # else:
430
- # st.title("SIGN UP TO ACCESS THE APP!")
431
- # AUTHORIZE_ENDPOINT = "https://accounts.google.com/o/oauth2/v2/auth"
432
- # TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token"
433
- # REVOKE_ENDPOINT = "https://oauth2.googleapis.com/revoke"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
 
435
- # # create a button to start the OAuth2 flow
436
- # oauth2 = OAuth2Component(
437
- # CLIENT_ID,
438
- # CLIENT_SECRET,
439
- # AUTHORIZE_ENDPOINT,
440
- # TOKEN_ENDPOINT,
441
- # TOKEN_ENDPOINT,
442
- # REVOKE_ENDPOINT,
443
- # )
444
- # result = oauth2.authorize_button(
445
- # name="Continue with Google",
446
- # icon="https://www.google.com.tw/favicon.ico",
447
- # redirect_uri="https://huggingface.co/spaces/coffeebeans-ai/rfp_to_story",
448
- # scope="openid email profile",
449
- # key="google",
450
- # height=600,
451
- # width=500,
452
- # extras_params={"prompt": "consent", "access_type": "offline"},
453
- # use_container_width=False,
454
- # pkce="S256",
455
- # )
456
 
457
- # if result:
458
- # # decode the id_token jwt and get the user's email address
459
- # id_token = result["token"]["id_token"]
460
- # # verify the signature is an optional step for security
461
- # payload = id_token.split(".")[1]
462
- # # add padding to the payload if needed
463
- # payload += "=" * (-len(payload) % 4)
464
- # payload = json.loads(base64.b64decode(payload))
465
- # email = payload["email"]
466
- # st.session_state["auth"] = email
467
- # st.session_state["token"] = result["token"]
468
- # is_valid = validate_email(email)
469
- # if is_valid:
470
- # localStorage.setItem("email",email)
471
- # st.rerun()
472
- # else:
473
- # st.warning("Unauthorized. you are not authorized to access this app.")
474
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
 
 
2
  import os
 
 
 
 
 
 
 
 
3
  import streamlit as st
4
  from streamlit_option_menu import option_menu
 
 
 
5
  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
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:
 
26
  st.session_state["is_data_processed"] = False
27
  if "user_stories" not in st.session_state:
28
  st.session_state["user_stories"] = ""
29
+ if "user_stories_data" not in st.session_state:
30
+ st.session_state["user_stories_data"] = []
31
  if "user_stories_json" not in st.session_state:
32
+ st.session_state["user_stories_json"] = {}
33
  if "is_user_stories_created" not in st.session_state:
34
  st.session_state["is_user_stories_created"] = False
35
  if "rfp_summary" not in st.session_state:
36
  st.session_state["rfp_summary"] = ""
37
+ if "estimation_data" not in st.session_state:
38
+ st.session_state["estimation_data"] = []
39
+ if "is_estimation_data_created" not in st.session_state:
40
+ st.session_state["is_estimation_data_created"] = False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  def main():
44
+ function = RFPProcessor()
45
+
46
  if "input" not in st.session_state:
47
  st.session_state["input"] = ""
48
 
49
  with st.sidebar:
50
+ menu_choice = option_menu(
51
+ menu_title="RFPStoryCraft",
52
+ options=["Home", "RFP Bot", "User Stories", "Summary", "Estimations"],
53
+ icons=["house", "list-task", "book", "book", "list-task"],
54
+ )
55
+
56
  if st.session_state["is_data_processed"] == True:
57
+ st.button("Clear RFP Data", on_click=clear_rfp_data)
 
 
58
 
59
+ # if localStorage.getItem("email"):
60
+ # st.button("Log out", on_click=lambda: log_out_user(localStorage))
61
+
62
+ if menu_choice == "Home":
63
  with st.form("my_form"):
64
+ project_name = st.text_input(
65
+ "Project Name",
66
+ key="Project Name",
67
+ type="default",
68
+ placeholder="Project Name",
69
+ )
70
+ file = st.file_uploader("Document", type="pdf")
71
 
72
  submitted = st.form_submit_button("Process Data")
73
 
74
  if submitted:
75
  if project_name and file:
76
+ function.process_rfp_data(project_name, file)
77
  else:
78
  st.warning(
79
+ "project_name and file are required to create create stories",
80
+ icon="⚠️",
81
+ )
82
 
83
+ if menu_choice == "RFP Bot":
84
  if st.session_state["is_data_processed"] == True:
85
  st.title(" RFP Chatbot ")
86
  st.subheader(" Powered by Coffeebeans")
87
+ st.text_input(
88
+ "You: ",
89
+ st.session_state["input"],
90
+ key="input",
91
+ placeholder="Your AI assistant here! Ask me Queries related to RFP",
92
+ on_change=function.genrate_bot_result(),
93
+ label_visibility="hidden",
94
+ )
95
  with st.container():
96
+ for i in range(len(st.session_state["generated"]) - 1, -1, -1):
97
  st.success(st.session_state["generated"][i], icon="🤖")
98
  st.info(st.session_state["past"][i], icon="🧐")
99
  else:
100
+ st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
 
101
 
102
+ if menu_choice == "User Stories":
103
  if st.session_state["is_data_processed"] == True:
104
  st.title("User Stories")
105
+ st.button(
106
+ "Genrate User Stories",
107
+ type="primary",
108
+ on_click=function.genrate_user_stories,
109
+ )
110
  if st.session_state["is_user_stories_created"] == True:
111
+ st.button("Export Stories", on_click=lambda: export(st.session_state["user_stories_data"]))
112
+ with st.container():
113
+ df = pd.DataFrame(st.session_state["user_stories_data"])
114
+ st.table(df)
 
 
115
  else:
116
+ st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
 
117
 
118
+ if menu_choice == "Summary":
119
  if st.session_state["is_data_processed"] == True:
120
  st.title("Summary")
121
  with st.container():
122
  st.markdown(st.session_state["rfp_summary"])
123
  else:
124
+ st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
 
125
 
126
+ if menu_choice == "Estimations":
127
+ if st.session_state["is_data_processed"] == True:
128
+ st.title("Estimations")
129
+ senior_developers = st.text_input(
130
+ label="Number of Senior Developers",
131
+ placeholder="Enter here....",
132
+ )
133
+ junior_developers = st.text_input(
134
+ label="Number of Junior Developers",
135
+ placeholder="Enter here...",
136
+ )
137
+ tech_leads = st.text_input(
138
+ label="Number of Tech Leads",
139
+ placeholder="Enter here....",
140
+ )
141
+
142
+ if senior_developers and junior_developers and tech_leads and st.session_state["is_user_stories_created"] == True:
143
+ st.button(
144
+ "Generate Estimations",
145
+ on_click=lambda: function.generate_estimations(tech_leads, senior_developers, junior_developers),
146
+ )
147
+
148
+ if st.session_state["is_estimation_data_created"] == True:
149
+ if st.session_state["is_estimation_data_created"] == True:
150
+ st.button("Export Stories", on_click = lambda: export(st.session_state["estimation_data"]))
151
+ with st.container():
152
+ df = pd.DataFrame(st.session_state["estimation_data"])
153
+ st.table(df)
154
 
155
+ else:
156
+ st.warning("Plesase Process RFP Details to access this feature", icon="⚠️")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
+ if __name__ == "__main__":
160
+ # if localStorage.getItem("email"):
161
+ main()
162
+ # else:
163
+ # authenticate(localStorage)