Zekun Wu commited on
Commit
4864213
·
1 Parent(s): cdebdb6
Files changed (1) hide show
  1. app.py +3 -53
app.py CHANGED
@@ -191,6 +191,8 @@ def generate_prompt_from_profile(profile, version="TeamSummary"):
191
 
192
  prompt = prompt_templates[0].replace("{{TEAM_MEMBERS}}", team_member_profiles_str)
193
 
 
 
194
 
195
  except KeyError as e:
196
  return [{"role": "system", "content": f"Error processing profile data: missing {str(e)}"}]
@@ -215,16 +217,6 @@ def display_profile_info(profile):
215
  st.sidebar.markdown("\n".join([f"- **{attribute}**: {details['score']}" for attribute, details in main_profile.items()]))
216
  st.sidebar.markdown("### Red Flags:")
217
  st.sidebar.markdown("\n".join([f"- **{attribute}**: {details['score']}" for attribute, details in red_flag.items()]))
218
- # main_profile = profile["main_profile"]
219
- # red_flag = profile["red_flag"]
220
- # bio_info = profile["bio_information"]
221
- #
222
- # st.sidebar.markdown("### Bio Information: ")
223
- # st.sidebar.markdown("\n".join([f"- **{key.replace('_', ' ')}**: {value}" for key, value in bio_info.items()]))
224
- # st.sidebar.markdown("### Main Profile: ")
225
- # st.sidebar.markdown("\n".join([f"- **{attribute}**: {details['score']} - {details['summary']}" for attribute, details in main_profile.items()]))
226
- # st.sidebar.markdown("### Red Flags: ")
227
- # st.sidebar.markdown("\n".join([f"- **{attribute}**: {details['score']} - {details['summary']}" for attribute, details in red_flag.items()]))
228
 
229
  def validate_json(profile):
230
  required_keys = ['Team']
@@ -301,25 +293,6 @@ def main_app():
301
  else:
302
  st.write("Please upload a profile JSON file or use the example profile.")
303
 
304
- # if st.session_state['analysis']:
305
- # st.markdown(st.session_state['analysis'])
306
- # #st.markdown("### Analysis:")
307
- # #analysis_container = st.container()
308
- # # with analysis_container:
309
- # #st.markdown(st.session_state['analysis'].choices[0].message.content)
310
- #
311
- # st.markdown("### Token Usage:")
312
- # token_usage_container = st.expander("Show Token Usage Details")
313
- # with token_usage_container:
314
- # total_tokens = st.session_state['analysis'].usage.total_tokens
315
- # prompt_tokens = st.session_state['analysis'].usage.prompt_tokens
316
- # completion_tokens = st.session_state['analysis'].usage.completion_tokens
317
- # costs = (0.01 / 1000) * prompt_tokens + (0.03 / 1000) * completion_tokens
318
- # st.write(f'**Total tokens:** {total_tokens}')
319
- # st.progress(completion_tokens / 1000)
320
- # st.write(f'**Prompt tokens:** {prompt_tokens}')
321
- # st.write(f'**Completion tokens:** {completion_tokens}')
322
- # st.write(f'**Generation costs ($):** {costs}')
323
 
324
  # Function to verify credentials and set the session state
325
  def verify_credentials():
@@ -390,30 +363,7 @@ def sidebar_components():
390
  st.sidebar.title("Chat with Our Career Advisor")
391
  st.sidebar.markdown("Hello, we hope you learned something about yourself in this report. This chat is here so you can ask any questions you have about your report! It’s also a great tool to get ideas about how you can use the information in your report for your personal development and achieving your current goals.")
392
 
393
- # question_message = generate_prompt_from_profile(st.session_state['profile'])
394
- # question_message.append(
395
- # {"role": "system", "content": st.session_state['analysis'].choices[0].message.content})
396
- # question_prompt = (
397
- # f"Based on the earlier profile summary and analysis results about the individual, "
398
- # f"generate two insightful questions that could be asked by that individual for further discussion about themself:\n\n"
399
- # f"Provide me the questions in different new line."
400
- # f"Suggested Questions:\n"
401
- # )
402
- #question_message.append({"role": "user", "content": question_prompt})
403
-
404
- # questions = generate_one_completion(question_message, 0)
405
- #
406
- # questions_list = [question.strip() for question in questions.choices[0].message.content.split('\n')
407
- # if question.strip()]
408
-
409
- # questions_list = []
410
- # print(questions_list)
411
- # # Prepare the questions for Markdown display
412
- # questions_markdown = "\n\n".join(
413
- # [f"Q{question}" for index, question in enumerate(questions_list[:2])])
414
-
415
- # Name to be included in the questions
416
- #name = st.session_state['profile']['bio_information'].get('Name', 'the individual')
417
 
418
  # List of question templates where {} will be replaced with the name
419
  question_templates = [
 
191
 
192
  prompt = prompt_templates[0].replace("{{TEAM_MEMBERS}}", team_member_profiles_str)
193
 
194
+ print(prompt)
195
+
196
 
197
  except KeyError as e:
198
  return [{"role": "system", "content": f"Error processing profile data: missing {str(e)}"}]
 
217
  st.sidebar.markdown("\n".join([f"- **{attribute}**: {details['score']}" for attribute, details in main_profile.items()]))
218
  st.sidebar.markdown("### Red Flags:")
219
  st.sidebar.markdown("\n".join([f"- **{attribute}**: {details['score']}" for attribute, details in red_flag.items()]))
 
 
 
 
 
 
 
 
 
 
220
 
221
  def validate_json(profile):
222
  required_keys = ['Team']
 
293
  else:
294
  st.write("Please upload a profile JSON file or use the example profile.")
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
  # Function to verify credentials and set the session state
298
  def verify_credentials():
 
363
  st.sidebar.title("Chat with Our Career Advisor")
364
  st.sidebar.markdown("Hello, we hope you learned something about yourself in this report. This chat is here so you can ask any questions you have about your report! It’s also a great tool to get ideas about how you can use the information in your report for your personal development and achieving your current goals.")
365
 
366
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
 
368
  # List of question templates where {} will be replaced with the name
369
  question_templates = [