Spaces:
Running
Running
Jonah Ramponi
commited on
Commit
·
0c3cc21
1
Parent(s):
0c94c61
cleanup 2
Browse files- .streamlit/config.toml +8 -1
- CVReview.py +61 -57
- Interview.py +8 -8
- 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 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
critique_type
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
resultsDict
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
#
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
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 |
-
"
|
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",
|