File size: 9,396 Bytes
667c2bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

import openai
import streamlit as st
import fitz
            
import streamlit as st

def developer_details():
    st.sidebar.markdown("# Developer Details")
    
    developers = [
        {
            "name": "Sudhir Sharma",
            "role": "B.Tech CSE - IIT Bhilai 2024",
            "email": "[email protected]",
            "github": "https://github.com/Sudhir878786",
            "linkedin": "https://www.linkedin.com/in/sudhirsharma87/",
            "avatar": "https://avatars.githubusercontent.com/u/92601949?v=4",  # Replace with actual image URL
        },
        # Add more developers if needed
    ]
    
    for developer in developers:
        st.sidebar.markdown(f"## {developer['name']}")
        st.sidebar.image(developer['avatar'], width=150)
        st.sidebar.write(f"**Role:** {developer['role']}")
        st.sidebar.write(f"**Email:** {developer['email']}")
        st.sidebar.write(f"**GitHub:** {developer['github']}")
        st.sidebar.write(f"**LinkedIn:** {developer['linkedin']}")
        st.sidebar.markdown("---")

# Call the function to display the container in the sidebar
developer_details()


def prompt1(company,position,round,intervier_level):
    prompt=f"""
    I want you to act as a {intervier_level} for {round} interviews on {company} company for the position of {position}. You'll suggest the characteristics of this job interview and the characteristics of the {company}'s interview. 
    The return format should bullet point be like this:
    Characteristics of this job interview:
    - name: detail explanation  
    Characteristics of {company}:
    - name: detail explanation
    """
    return prompt

def followup1(company,position,round,bullet_point):
    prompt=f"""
    Can you talk the detail about {bullet_point} for {round} interviews on {company} company for the position of {position}?
    The return format should bullet point be like this:
    - name: detail explanation
    """
    return prompt

def prompt2(position):
    prompt=f"""
    I want you to act as a talent recruiter for the position of {position}'s interviews. You'll suggest the characteristics of this job interview for both behavior requirement and technical requirement. 
    The return format should bullet point be like this:
    Characteristics of this behavior requirement:
    - name: detail explanation  
    Characteristics of technical requirement:
    - name: detail explanation
    """
    return prompt

def followup2(position,bullet_point):
    prompt=f"""
    Can you talk the detail about {bullet_point} for the interview of {position}?
    The return format should bullet point be like this:
    - name: detail impovement advice
    """
    return prompt

def prompt3(position,resume,dis_num,ad_num):
    prompt=f"""
    I want you to act as a talent recruiter for hiring {position}. I will give you a resume and you'll suggest what are {dis_num}+ disadvantages and {ad_num}+ advantages of the {position} position. Please remember, the return should be highly related to the {position} position.
    The return format should bullet point be like this:
      Disadvatage: 
      - name: Suggestions for improvements to make the resume more appropriate for the {position} position and link to specific sentences on the resume.
      Advantage:
      - name: use one sentence to explain why it is advantageous for the {position} position.
      
    Here is the resume:
    {resume}.
    """
    return prompt

def followup3(position,resume,bullet_point):
    prompt=f"""
    Can you talk the detail about {bullet_point} for the position of {position} based on {resume}?
    The return format should bullet point be like this:
    - name: detail impovement advice
    """
    return prompt


def ask(prompt):
  rsp = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[
          {"role": "system", "content": prompt},
      ]
  )

  output=rsp.choices[0].message.content
  return output

####################

st.title('IntervuPro.Ai')
st.subheader('A tool using to help people prepare their interview by using gpt3.5')

# environment setup
key=st.text_input('Please input your OpenAI key')
openai.api_key=key

option = st.selectbox(
    'How would you like to prepare for the interview?',
    ('Prepare for a specific interview',
    'Understand the requirement of a specific position',
    'Analyze resume', 
    ))

if "submit" not in st.session_state:
    st.session_state["submit"] = False

st.write('')
###### option 1
if option=='Prepare for a specific interview':
    col1, col2= st.columns(2)
    with col1:
        company=st.text_input('Input your company','Amazon')
    with col2:
        position=st.text_input('Input your position','Data engineer')
        
    col3, col4 = st.columns(2)
    with col3:
        intervier_level=st.text_input('Input your interviewer level: ','Talent Recuriter')
    with col4:
        round=st.radio('Select your round: ',('Phone Screen','Behavior Interview','Technical Interview', 'General'))
        if round=='General':
            round=''
    
    st.write('Click button again if you want to regenerate a new ansewer.')
    submit_button=st.button('Submit')
    
    if st.session_state.get('button') != True:
        st.session_state['button'] = submit_button
    if st.session_state['button'] == True:
        prompt=prompt1(company,position,round,intervier_level)
        output=ask(prompt)
        st.write(output)  
            
        followup_time=0
        followup=''
        while True:
            output_list=output.split('\n')
            indexes = [i for i, word in enumerate(output_list) if '- ' in word]
            new_list = [output_list[i] for i in indexes]
            Cq=[i.split(':')[0].strip('- ') for i in new_list]
            Cq = ['None']+ Cq
            
            followup_radio = st.radio('I want to follow up:', tuple(Cq),key='0')
            if followup_radio:
                followup_time +=1
                if followup_radio == 'None':
                    break
                else:
                    if followup_radio != 'None':
                        followup = followup1(company, position, round, followup_radio)
                        output = ask(followup)
                        st.write(output)
                    if followup_time>5:
                        break   


###### option 2
if option =='Understand the requirement of a specific position':
    position=st.text_input('Input your position','Data engineer')
        
    st.write('Click button again if you want to regenerate a new ansewer.')

    #submit=st.checkbox('submit')
    submit=st.button('submit')

    if submit:
        prompt=prompt2(position)
        output=ask(prompt)
        st.write(output)  
            
        followup=''
        output_list=output.split('\n')
        indexes = [i for i, word in enumerate(output_list) if '- ' in word]
        new_list = [output_list[i] for i in indexes]
        Cq=[i.split(':')[0].strip('- ') for i in new_list]
        Cq = ['None']+ Cq


        followup_radio = st.radio('I want to follow up:', tuple(Cq))
        if followup_radio!='None':
            followup = followup2(position,followup_radio)
            op = ask(followup)
            st.write(op)
    
    
###### option 3

if option =='Analyze resume':
    
    # col31, col32,col33= st.columns(3)
    # with col31:
    #     position=st.text_input('Input your position','data engineer')
    # with col32:
    #     dis_num=st.text_input('Input your dis_num','6')
    # with col33:
    #     ad_num=st.text_input('Input your ad_num','4')
    
    position=st.text_input('Input your position','data engineer')
    dis_num=6
    ad_num=4

    uploaded_file = st.file_uploader("Upload your resume", type=["pdf"]) 
    if uploaded_file:
        
        if "submit" not in st.session_state:
            st.session_state["submit"] = False
        
        doc = fitz.open(stream=uploaded_file.read(), filetype="pdf")
        resume = ""
        for page in doc:
            resume += page.get_text()
        
        st.write('Click button again if you want to regenerate a new ansewer.')
        submit_button=st.button('Submit')
        
        if st.session_state.get('button') != True:
            st.session_state['button'] = submit_button
        if st.session_state['button'] == True:
            prompt=prompt3(position,resume,dis_num,ad_num)
            output=ask(prompt)
            st.write(output)  
            
            followup_time=0
            while True:
                output_list=output.split('\n')
                output_list= [element for element in output_list if element != '']

                ind = [i for i, word in enumerate(output_list) if 'Advantage:' in word]
                Cdis_list=output_list[1:int(dis_num)+1]
                Cdis=[i.split(':')[0].strip('- ') for i in Cdis_list]
                Cdis = ['None']+ Cdis
                
                followup_radio = st.radio('I want to follow up:', tuple(Cdis),key=followup_time)
                followup_time +=1
                if followup_radio == 'None':
                    break
                else:
                    followup = followup3(position,resume,followup_radio)
                    output = ask(followup)
                    st.write(output)
                if followup_time>4:
                    break