File size: 1,835 Bytes
104daa7
65d169c
 
 
 
3d1607e
65d169c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3d1607e
bd56c80
 
 
 
 
 
 
 
 
 
 
 
104daa7
 
 
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
import streamlit as st 
import openai
from dotenv import load_dotenv
import os 
import sys

load_dotenv()

openai.api_key = os.environ.get("OPENAI_API_KEY")

def get_chat_completion(iContent):
    conv_list=[{"role":"system", "content":f'''You are the world's best interviewer. The model will be given an interview transcript between interviewer and candidate. Based on job profile given in the title, evaluate candidate and rate the candidate on communications ,technical skills, practical skills and attitude. Give the answer in points and describe each point with the rating. For eg:

Attitude: Rating out of 10
Confidence: Rating out of 10
Technical Skills:  Rating out of 10
Practical skills: Rating out of 10

Give Overall rating and verdict for if the candidate has to be considered for next round along with above ratings \n
                {iContent}'''}]
    
    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo-16k",
        messages=conv_list,
        temperature=0,  
        # max_tokens=50,    
        # frequency_penalty=0.5,  
        # presence_penalty=0.2,  
    )
    return response['choices'][0]['message']['content'].strip()


if __name__=="__main__":
    iContent=st.text_area("Enter Transcript")
    # uploaded_file = st.file_uploader("Upload a file", type=["txt", "docx"])
    st.json({'feedback':get_chat_completion(iContent)})
    # if iContent and uploaded_file:
    #     content= uploaded_file.read()
    #     st.code(content, language="txt")
    #     st.json({'feedback':get_chat_completion(content)})
    # elif iContent:
    #     st.json({'feedback':get_chat_completion(iContent)})
    # elif uploaded_file:
    #     content= uploaded_file.read()
    #     st.code(content, language="txt")
    #     st.json({'feedback':get_chat_completion(content)})