import openai import gradio as gr 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("""Image Image""") with gr.Row(elem_id="col-container"): with gr.Column(): gr.HTML("
") gr.HTML( """

Generate Job Description

""" ) gr.HTML("
") with gr.Column(): rolls = gr.Textbox(label="Rolls") 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()