Jonah Ramponi commited on
Commit
0c3cc21
·
1 Parent(s): 0c94c61
Files changed (4) hide show
  1. .streamlit/config.toml +8 -1
  2. CVReview.py +61 -57
  3. Interview.py +8 -8
  4. app.py +1 -1
.streamlit/config.toml CHANGED
@@ -1,2 +1,9 @@
1
  [client]
2
- showSidebarNavigation = false
 
 
 
 
 
 
 
 
1
  [client]
2
+ showSidebarNavigation = false
3
+ toolbarMode = "viewer"
4
+
5
+ [theme]
6
+ primaryColor = "#d93407"
7
+ backgroundColor = "white"
8
+ textColor = "#3e4047"
9
+ font = "serif"
CVReview.py CHANGED
@@ -54,60 +54,64 @@ def CVReviewPage():
54
 
55
  SHARED_STATE = st.session_state.shared_materials
56
  API_KEY = st.session_state.api_key
57
-
58
- produce_report = st.button("Produce Suitability Report")
59
- if produce_report:
60
- try:
61
- results = {}
62
- # We will make 3 calls in parallel, to get various bits of information efficiently
63
- with concurrent.futures.ThreadPoolExecutor() as executor:
64
-
65
- futures = {
66
- critique_type: executor.submit(
67
- produce_report,
68
- SHARED_STATE["cv"],
69
- SHARED_STATE["job_posting"],
70
- critique_type,
71
- API_KEY,
72
- )
73
- for critique_type in ["basic", "general", "specific"]
74
- }
75
-
76
- for critique_type, future in futures.items():
77
- results[critique_type] = future.result()
78
-
79
- except LocalProtocolError:
80
- st.error("You need to enter a Cohere API Key.")
81
- except ApiError:
82
- st.error("You need a valid Cohere API Key")
83
-
84
- # merge the from our calls, by extracting the json object from the gpt message
85
- resultsDict = {}
86
- for jsonText in results.values():
87
- _, output_report_json = extract_json(jsonText)
88
-
89
- resultsDict.update(output_report_json)
90
-
91
- # store this as the report object
92
- SHARED_STATE["report"] = resultsDict
93
-
94
- # if the report object exists
95
- if SHARED_STATE["report"]:
96
- REPORT = SHARED_STATE["report"]
97
-
98
- # these are used for file naming
99
- name = REPORT.get("personName", "MissingPersonName")
100
- job_title = REPORT.get("jobTitle", "MissingTitle")
101
- company_name = REPORT.get("companyName", "MissingCompany")
102
-
103
- # render markdown report
104
- st.markdown(generate_markdown_report(REPORT))
105
-
106
- # Downloadable in json form !
107
- st.download_button(
108
- label="Download Report JSON",
109
- data=json.dumps(REPORT, indent=4),
110
- file_name=f"{name}_{job_title}_{company_name}.json",
111
- mime="application/json",
112
- use_container_width=True,
113
- )
 
 
 
 
 
54
 
55
  SHARED_STATE = st.session_state.shared_materials
56
  API_KEY = st.session_state.api_key
57
+ if not SHARED_STATE["valid_flag"]:
58
+ st.error("You need to upload a Job Description & CV to use this feature.")
59
+ else:
60
+
61
+ produce_report_button = st.button("Produce Suitability Report")
62
+
63
+ if produce_report_button:
64
+ try:
65
+ results = {}
66
+ # We will make 3 calls in parallel, to get various bits of information efficiently
67
+ with concurrent.futures.ThreadPoolExecutor() as executor:
68
+
69
+ futures = {
70
+ critique_type: executor.submit(
71
+ produce_report,
72
+ SHARED_STATE["cv"],
73
+ SHARED_STATE["job_posting"],
74
+ critique_type,
75
+ API_KEY,
76
+ )
77
+ for critique_type in ["basic", "general", "specific"]
78
+ }
79
+
80
+ for critique_type, future in futures.items():
81
+ results[critique_type] = future.result()
82
+
83
+ except LocalProtocolError:
84
+ st.error("You need to enter a Cohere API Key.")
85
+ except ApiError:
86
+ st.error("You need a valid Cohere API Key")
87
+
88
+ # merge the from our calls, by extracting the json object from the gpt message
89
+ resultsDict = {}
90
+ for jsonText in results.values():
91
+ _, output_report_json = extract_json(jsonText)
92
+
93
+ resultsDict.update(output_report_json)
94
+
95
+ # store this as the report object
96
+ SHARED_STATE["report"] = resultsDict
97
+
98
+ # if the report object exists
99
+ if SHARED_STATE["report"]:
100
+ REPORT = SHARED_STATE["report"]
101
+
102
+ # these are used for file naming
103
+ name = REPORT.get("personName", "MissingPersonName")
104
+ job_title = REPORT.get("jobTitle", "MissingTitle")
105
+ company_name = REPORT.get("companyName", "MissingCompany")
106
+
107
+ # render markdown report
108
+ st.markdown(generate_markdown_report(REPORT))
109
+
110
+ # Downloadable in json form !
111
+ st.download_button(
112
+ label="Download Report JSON",
113
+ data=json.dumps(REPORT, indent=4),
114
+ file_name=f"{name}_{job_title}_{company_name}.json",
115
+ mime="application/json",
116
+ use_container_width=True,
117
+ )
Interview.py CHANGED
@@ -31,17 +31,17 @@ def InterviewPage():
31
  SHARED_STATE = st.session_state.shared_materials
32
  API_KEY = st.session_state.api_key
33
 
34
- clear_conversation = st.button("Clear Conversation")
35
-
36
- # Clear conversation will clear message state, and initialize with a new random question
37
- if clear_conversation:
38
- st.session_state["messages"] = [
39
- {"role": "assistant", "message": random.choice(initial_questions)}
40
- ]
41
-
42
  if not SHARED_STATE["valid_flag"]:
43
  st.error("You need to upload a Job Description & CV to use this feature.")
44
  else:
 
 
 
 
 
 
 
 
45
  try:
46
  # Populate the chat with historic messages
47
  for msg in MESSAGES:
 
31
  SHARED_STATE = st.session_state.shared_materials
32
  API_KEY = st.session_state.api_key
33
 
 
 
 
 
 
 
 
 
34
  if not SHARED_STATE["valid_flag"]:
35
  st.error("You need to upload a Job Description & CV to use this feature.")
36
  else:
37
+ clear_conversation = st.button("Clear Conversation")
38
+
39
+ # Clear conversation will clear message state, and initialize with a new random question
40
+ if clear_conversation:
41
+ st.session_state["messages"] = [
42
+ {"role": "assistant", "message": random.choice(initial_questions)}
43
+ ]
44
+
45
  try:
46
  # Populate the chat with historic messages
47
  for msg in MESSAGES:
app.py CHANGED
@@ -64,7 +64,7 @@ def main():
64
 
65
  pg = st.navigation(
66
  {
67
- "Job Search AI Tools": [
68
  st.Page(
69
  InterviewPage,
70
  title="Practice Interview",
 
64
 
65
  pg = st.navigation(
66
  {
67
+ "Jonah's AI Job Tools": [
68
  st.Page(
69
  InterviewPage,
70
  title="Practice Interview",