Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,6 @@ css_style = """
|
|
20 |
}
|
21 |
"""
|
22 |
|
23 |
-
|
24 |
def run(uploaded_files):
|
25 |
all_files = []
|
26 |
if uploaded_files is None:
|
@@ -31,19 +30,26 @@ def run(uploaded_files):
|
|
31 |
print(all_files)
|
32 |
return all_files
|
33 |
|
34 |
-
|
35 |
def createAnswer(files, designation, openaikey):
|
|
|
36 |
os.environ['OPENAI_API_KEY'] = openaikey.strip()
|
|
|
|
|
37 |
docs = Docs(llm='gpt-3.5-turbo')
|
|
|
|
|
38 |
for d in files:
|
39 |
docs.add(d.name)
|
|
|
|
|
40 |
answer = docs.query(
|
41 |
-
f"Who is the best
|
|
|
|
|
42 |
print(answer.formatted_answer)
|
43 |
print(type(answer))
|
44 |
return answer.answer
|
45 |
|
46 |
-
|
47 |
with gr.Blocks(css=css_style) as demo:
|
48 |
gr.Markdown(f"""
|
49 |
# HR-GPT - Filter & Find The Best Candidate for the Job using AI
|
@@ -75,4 +81,4 @@ with gr.Blocks(css=css_style) as demo:
|
|
75 |
uploaded_files, position, openaikey], outputs=[answer])
|
76 |
|
77 |
demo.queue(concurrency_count=20)
|
78 |
-
demo.launch(show_error=True)
|
|
|
20 |
}
|
21 |
"""
|
22 |
|
|
|
23 |
def run(uploaded_files):
|
24 |
all_files = []
|
25 |
if uploaded_files is None:
|
|
|
30 |
print(all_files)
|
31 |
return all_files
|
32 |
|
|
|
33 |
def createAnswer(files, designation, openaikey):
|
34 |
+
# Set the OpenAI API key as an environment variable
|
35 |
os.environ['OPENAI_API_KEY'] = openaikey.strip()
|
36 |
+
|
37 |
+
# Initialize the Docs object with the OpenAI API key
|
38 |
docs = Docs(llm='gpt-3.5-turbo')
|
39 |
+
|
40 |
+
# Add the uploaded files to the Docs object
|
41 |
for d in files:
|
42 |
docs.add(d.name)
|
43 |
+
|
44 |
+
# Query the documents to find the best candidate for the given designation
|
45 |
answer = docs.query(
|
46 |
+
f"Who is the best candidate to hire for {designation}. Provide a list with the candidate name. If you don't know, simply say None of the candidates are suited for the Job role."
|
47 |
+
)
|
48 |
+
|
49 |
print(answer.formatted_answer)
|
50 |
print(type(answer))
|
51 |
return answer.answer
|
52 |
|
|
|
53 |
with gr.Blocks(css=css_style) as demo:
|
54 |
gr.Markdown(f"""
|
55 |
# HR-GPT - Filter & Find The Best Candidate for the Job using AI
|
|
|
81 |
uploaded_files, position, openaikey], outputs=[answer])
|
82 |
|
83 |
demo.queue(concurrency_count=20)
|
84 |
+
demo.launch(show_error=True)
|