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