Spaces:
Sleeping
Sleeping
Commit
·
5d3df5a
1
Parent(s):
02b8759
Going back to older version
Browse files- main.py +4 -3
- prompts.yaml +10 -10
main.py
CHANGED
@@ -18,12 +18,13 @@ def process_resume(input_method, resume_text, pdf_file):
|
|
18 |
else:
|
19 |
if pdf_file is None:
|
20 |
return "No PDF uploaded."
|
21 |
-
#
|
22 |
if isinstance(pdf_file, str):
|
23 |
with open(pdf_file, "rb") as f:
|
24 |
file_bytes = f.read()
|
25 |
else:
|
26 |
file_bytes = pdf_file.read()
|
|
|
27 |
file_obj = io.BytesIO(file_bytes)
|
28 |
text = extract_text_from_pdf(file_obj)
|
29 |
|
@@ -31,11 +32,11 @@ def process_resume(input_method, resume_text, pdf_file):
|
|
31 |
return "No resume text found."
|
32 |
|
33 |
agent = create_agent()
|
34 |
-
#
|
|
|
35 |
response = agent.run(f"Roast this resume: {text}")
|
36 |
return response
|
37 |
|
38 |
-
|
39 |
def toggle_inputs(method):
|
40 |
if method == "Text":
|
41 |
return gr.update(visible=True), gr.update(visible=False)
|
|
|
18 |
else:
|
19 |
if pdf_file is None:
|
20 |
return "No PDF uploaded."
|
21 |
+
# pdf_file may be a file path or a file-like object; handle accordingly
|
22 |
if isinstance(pdf_file, str):
|
23 |
with open(pdf_file, "rb") as f:
|
24 |
file_bytes = f.read()
|
25 |
else:
|
26 |
file_bytes = pdf_file.read()
|
27 |
+
import io
|
28 |
file_obj = io.BytesIO(file_bytes)
|
29 |
text = extract_text_from_pdf(file_obj)
|
30 |
|
|
|
32 |
return "No resume text found."
|
33 |
|
34 |
agent = create_agent()
|
35 |
+
# Directly run the agent to roast the resume. With our updated prompts,
|
36 |
+
# the agent should output plain text that we can simply print.
|
37 |
response = agent.run(f"Roast this resume: {text}")
|
38 |
return response
|
39 |
|
|
|
40 |
def toggle_inputs(method):
|
41 |
if method == "Text":
|
42 |
return gr.update(visible=True), gr.update(visible=False)
|
prompts.yaml
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
system_prompt: |
|
2 |
-
You are a witty professional roaster who
|
3 |
-
Your job is to create a humorous
|
4 |
-
|
5 |
-
|
6 |
|
7 |
task_prompt: |
|
8 |
-
|
9 |
-
1. References key sections such as
|
10 |
-
2. Is humorous
|
11 |
-
3.
|
12 |
-
4. Adds creative flair that makes the roast both entertaining and insightful.
|
13 |
|
14 |
final_answer:
|
15 |
-
pre_messages: "Final Roast:"
|
16 |
post_messages: ""
|
|
|
|
1 |
system_prompt: |
|
2 |
+
You are a witty professional roaster who roasts resumes.
|
3 |
+
Your job is to create a humorous roast of a resume based solely on its content.
|
4 |
+
Keep the tone light, semi-professional, and extremely entertaining, with puns and jokes.
|
5 |
+
Add Meta jokes for Resume being too big, too short, other improvements and roasting if there is something funny on there, like casual buzzwords.
|
6 |
|
7 |
task_prompt: |
|
8 |
+
Given the provided resume details, craft a roast that:
|
9 |
+
1. References key sections such as Education, Projects, and Skills.
|
10 |
+
2. Is humorous yet semi-professional.
|
11 |
+
3. Outputs plain text without any code formatting.
|
|
|
12 |
|
13 |
final_answer:
|
14 |
+
pre_messages: "Final Roast: "
|
15 |
post_messages: ""
|
16 |
+
instructions: "Output your final roast as plain text with no code blocks."
|