Spaces:
Build error
Build error
Karthikeyan
commited on
Commit
·
62f5b3b
1
Parent(s):
9080d54
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import openai
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
class JobDescription():
|
| 5 |
+
def __init__(self):
|
| 6 |
+
# Set up your OpenAI API credentials
|
| 7 |
+
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 8 |
+
|
| 9 |
+
def generate_job_description(self, role, experience):
|
| 10 |
+
# Generate a response from the GPT-3 model
|
| 11 |
+
|
| 12 |
+
prompt = f"""Your task is generate Job description for this {role} with {experience} years of experience.
|
| 13 |
+
Job Description Must have
|
| 14 |
+
1. Job Title
|
| 15 |
+
2. Job Summary : [200 words]
|
| 16 |
+
3. Responsibilities : Five Responsibilities in five lines
|
| 17 |
+
4. Required Skills : Six Skills
|
| 18 |
+
5. Qualifications
|
| 19 |
+
These topics must have in that Generated Job Description.
|
| 20 |
+
"""
|
| 21 |
+
response = openai.Completion.create(
|
| 22 |
+
engine='text-davinci-003', # Choose the GPT-3 engine you want to use
|
| 23 |
+
prompt=prompt,
|
| 24 |
+
max_tokens=500, # Set the maximum number of tokens in the generated response
|
| 25 |
+
temperature=0.5, # Controls the randomness of the output. Higher values = more random, lower values = more focused
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
# Extract the generated text from the API response
|
| 29 |
+
generated_text = response.choices[0].text.strip()
|
| 30 |
+
|
| 31 |
+
return generated_text
|
| 32 |
+
|
| 33 |
+
def gradio_interface(self):
|
| 34 |
+
with gr.Blocks(css="style.css",theme=gr.themes.Soft()) as app:
|
| 35 |
+
gr.HTML("""<img class="leftimage" align="left" src="https://templates.images.credential.net/1612472097627370951721412474196.png" alt="Image" width="210" height="210">
|
| 36 |
+
<img class="rightimage" align="right" src="https://companieslogo.com/img/orig/RAND.AS_BIG-0f1935a4.png?t=1651813778" alt="Image" width="210" height="210">""")
|
| 37 |
+
|
| 38 |
+
with gr.Row(elem_id="col-container"):
|
| 39 |
+
with gr.Column():
|
| 40 |
+
gr.HTML("<br>")
|
| 41 |
+
gr.HTML(
|
| 42 |
+
"""<h1 style="text-align:center; color:"white">Generate Job Description</h1> """
|
| 43 |
+
)
|
| 44 |
+
gr.HTML("<br>")
|
| 45 |
+
with gr.Column():
|
| 46 |
+
rolls = gr.Textbox(label="Rolls")
|
| 47 |
+
with gr.Column():
|
| 48 |
+
experience = gr.Textbox(label="Experience")
|
| 49 |
+
with gr.Column():
|
| 50 |
+
analyse = gr.Button("Generate JD")
|
| 51 |
+
|
| 52 |
+
with gr.Column():
|
| 53 |
+
result = gr.Textbox(label="Job Description",lines=8)
|
| 54 |
+
|
| 55 |
+
analyse.click(self.generate_job_description, [rolls,experience], result)
|
| 56 |
+
|
| 57 |
+
app.launch()
|
| 58 |
+
|
| 59 |
+
jd=JobDescription()
|
| 60 |
+
jd.gradio_interface()
|