Ntabukiraniro commited on
Commit
7b7d785
1 Parent(s): 8ef37cc

Upload 7 files

Browse files
Files changed (7) hide show
  1. Homepage.py +197 -0
  2. LICENSE +21 -0
  3. README.md +77 -10
  4. icon.png +0 -0
  5. initialization.py +96 -0
  6. packages.txt +2 -0
  7. requirements.txt +14 -0
Homepage.py ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from streamlit_option_menu import option_menu
3
+ from app_utils import switch_page
4
+ import streamlit as st
5
+ from PIL import Image
6
+
7
+ im = Image.open("icon.png")
8
+ st.set_page_config(page_title = "AI Interviewer", layout = "centered",page_icon=im)
9
+
10
+ lan = st.selectbox("#### Language", ["English", "中文"])
11
+
12
+ if lan == "English":
13
+ home_title = "AI Interviewer"
14
+ home_introduction = "Welcome to AI Interviewer, empowering your interview preparation with generative AI."
15
+ with st.sidebar:
16
+ st.markdown('AI Interviewer - V0.1.2')
17
+ st.markdown("""
18
+ #### Let's contact:
19
+ [Haoxiang Jia](https://www.linkedin.com/in/haoxiang-jia/)
20
+
21
+ [Zicheng Wang](https://www.linkedin.com/in/todd-wang-5001aa264/)
22
+ #### Please fill the form, we'd love to have your feedback:
23
+ [Feedback Form](https://docs.google.com/forms/d/13f4q03bk4lD7sKR7qZ8UM1lQDo6NhRaAKv7uIeXHEaQ/edit)
24
+
25
+ #### Powered by
26
+
27
+ [OpenAI](https://openai.com/)
28
+
29
+ [FAISS](https://github.com/facebookresearch/faiss)
30
+
31
+ [Langchain](https://github.com/hwchase17/langchain)
32
+
33
+ """)
34
+ st.markdown(
35
+ "<style>#MainMenu{visibility:hidden;}</style>",
36
+ unsafe_allow_html=True
37
+ )
38
+ st.image(im, width=100)
39
+ st.markdown(f"""# {home_title} <span style=color:#2E9BF5><font size=5>Beta</font></span>""",unsafe_allow_html=True)
40
+ st.markdown("""\n""")
41
+ #st.markdown("#### Greetings")
42
+ st.markdown("Welcome to AI Interviewer! 👏 AI Interviewer is your personal interviewer powered by generative AI that conducts mock interviews."
43
+ "You can upload your resume and enter job descriptions, and AI Interviewer will ask you customized questions. Additionally, you can configure your own Interviewer!")
44
+ st.markdown("""\n""")
45
+ with st.expander("Updates"):
46
+ st.write("""
47
+ 08/13/2023
48
+ - Fix the error that occurs when the user input fails to be recorded. """)
49
+ with st.expander("What's coming next?"):
50
+ st.write("""
51
+ Improved voice interaction for a seamless experience. """)
52
+ st.markdown("""\n""")
53
+ st.markdown("#### Get started!")
54
+ st.markdown("Select one of the following screens to start your interview!")
55
+ selected = option_menu(
56
+ menu_title= None,
57
+ options=["Professional", "Resume", "Behavioral","Customize!"],
58
+ icons = ["cast", "cloud-upload", "cast"],
59
+ default_index=0,
60
+ orientation="horizontal",
61
+ )
62
+ if selected == 'Professional':
63
+ st.info("""
64
+ 📚In this session, the AI Interviewer will assess your technical skills as they relate to the job description.
65
+ Note: The maximum length of your answer is 4097 tokens!
66
+ - Each Interview will take 10 to 15 mins.
67
+ - To start a new session, just refresh the page.
68
+ - Choose your favorite interaction style (chat/voice)
69
+ - Start introduce yourself and enjoy! """)
70
+ if st.button("Start Interview!"):
71
+ switch_page("Professional Screen")
72
+ if selected == 'Resume':
73
+ st.info("""
74
+ 📚In this session, the AI Interviewer will review your resume and discuss your past experiences.
75
+ Note: The maximum length of your answer is 4097 tokens!
76
+ - Each Interview will take 10 to 15 mins.
77
+ - To start a new session, just refresh the page.
78
+ - Choose your favorite interaction style (chat/voice)
79
+ - Start introduce yourself and enjoy! """
80
+ )
81
+ if st.button("Start Interview!"):
82
+ switch_page("Resume Screen")
83
+ if selected == 'Behavioral':
84
+ st.info("""
85
+ 📚In this session, the AI Interviewer will assess your soft skills as they relate to the job description.
86
+ Note: The maximum length of your answer is 4097 tokens!
87
+ - Each Interview will take 10 to 15 mins.
88
+ - To start a new session, just refresh the page.
89
+ - Choose your favorite interaction style (chat/voice)
90
+ - Start introduce yourself and enjoy!
91
+ """)
92
+ if st.button("Start Interview!"):
93
+ switch_page("Behavioral Screen")
94
+ if selected == 'Customize!':
95
+ st.info("""
96
+ 📚In this session, you can customize your own AI Interviewer and practice with it!
97
+ - Configure AI Interviewer in different specialties.
98
+ - Configure AI Interviewer in different personalities.
99
+ - Different tones of voice.
100
+
101
+ Coming at the end of July""")
102
+ st.markdown("""\n""")
103
+ st.markdown("#### Wiki")
104
+ st.write('[Click here to view common FAQs, future updates and more!](https://jiatastic.notion.site/wiki-8d962051e57a48ccb304e920afa0c6a8?pvs=4)')
105
+ #st.write(
106
+ # f'<iframe src="https://17nxkr0j95z3vy.embednotionpage.com/AI-Interviewer-Wiki-8d962051e57a48ccb304e920afa0c6a8" style="width:100%; height:100%; min-height:500px; border:0; padding:0;"/>',
107
+ # unsafe_allow_html=True,
108
+ # )
109
+
110
+
111
+ if lan == '中文':
112
+ home_title = "AI面试官"
113
+ home_introduction = "欢迎使用 AI 面试官,它能够通过生成式AI帮助您准备面试。"
114
+ with st.sidebar:
115
+ st.markdown('AI面试管 - V0.1.2')
116
+ st.markdown("""
117
+ #### 领英:
118
+ [贾皓翔](https://www.linkedin.com/in/haoxiang-jia/)
119
+
120
+ [王梓丞](https://www.linkedin.com/in/todd-wang-5001aa264/)
121
+ #### 请填写表格,我们非常希望听到您的反馈:
122
+ [Feedback Form](https://docs.google.com/forms/d/13f4q03bk4lD7sKR7qZ8UM1lQDo6NhRaAKv7uIeXHEaQ/edit)
123
+
124
+ #### 使用的技术:
125
+
126
+ [OpenAI](https://openai.com/)
127
+
128
+ [FAISS](https://github.com/facebookresearch/faiss)
129
+
130
+ [Langchain](https://github.com/hwchase17/langchain)
131
+
132
+ """)
133
+ st.markdown(
134
+ "<style>#MainMenu{visibility:hidden;}</style>",
135
+ unsafe_allow_html=True
136
+ )
137
+ st.image(im, width=100)
138
+ st.markdown(f"""# {home_title} <span style=color:#2E9BF5><font size=5>Beta</font></span>""", unsafe_allow_html=True)
139
+
140
+ st.markdown("""\n""")
141
+ # st.markdown("#### Greetings")
142
+ st.markdown(
143
+ "欢迎使用AI面试官!👏AI面试官是一款由生成式人工智能驱动的个人面试官,可以进行模拟面试。您可以上传您的简历或者复制粘贴工作描述,AI面试官会根据您的情况提出定制化的问题。"
144
+ )
145
+ st.markdown("""\n""")
146
+ with st.expander("更新日志"):
147
+ st.write("""
148
+ 08/13/2023
149
+ - 修复了当用户输入失败时的报错问题 """)
150
+ with st.expander("未来计划"):
151
+ st.write("""
152
+ - 提供更加稳定和快速的语音交互
153
+ - 支持全中文的模拟面试 """)
154
+ st.markdown("""\n""")
155
+ st.markdown("#### 让我们开始吧!")
156
+ st.markdown("请选择以下其中一个开始您的面试!")
157
+ selected = option_menu(
158
+ menu_title=None,
159
+ options=["专业评估", "简历评估", "行为评估"],
160
+ icons=["cast", "cloud-upload", "cast"],
161
+ default_index=0,
162
+ orientation="horizontal",
163
+ )
164
+ if selected == '专业评估':
165
+ st.info("""
166
+ 📚在本次面试中,AI面试官将会根据职位描述评估您的技术能力。
167
+ 注意: 您回答的最大长度为4097个tokens!
168
+ - 每次面试将会持续10到15分钟。
169
+ - 您可以通过刷新页面来开始新的面试。
170
+ - 您可以选择您喜欢的交互方式(文字/语音)
171
+ - 开始介绍您自己吧! """)
172
+ if st.button("开始面试!"):
173
+ switch_page("Professional Screen")
174
+ if selected == '简历评估':
175
+ st.info("""
176
+ 📚在本次面试中,AI面试官将会根据您的简历评估您的过往经历。
177
+ 注意: 您回答的最大长度为4097个tokens!
178
+ - 每次面试将会持续10到15分钟。
179
+ - 您可以通过刷新页面来开始新的面试。
180
+ - 您可以选择您喜欢的交互方式(文字/语音)
181
+ - 开始介绍您自己吧! """)
182
+ if st.button("开始面试!"):
183
+ switch_page("Resume Screen")
184
+ if selected == '行为评估':
185
+ st.info("""
186
+ 📚在本次面试中,AI面试官将会根据您的简历评估您的技术能力。
187
+ 注意: 您回答的最大长度为4097个tokens!
188
+ - 每次面试将会持续10到15分钟。
189
+ - 您可以通过刷新页面来开始新的面试。
190
+ - 您可以选择您喜欢的交互方式(文字/语音)
191
+ - 开始介绍您自己吧! """)
192
+ if st.button("开始面试!"):
193
+ switch_page("Behavioral Screen")
194
+ st.markdown("""\n""")
195
+ st.markdown("#### 维基")
196
+ st.write(
197
+ '[点击查看常见问题,更新和计划!](https://jiatastic.notion.site/wiki-8d962051e57a48ccb304e920afa0c6a8?pvs=4)')
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Haoxiang Jia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,12 +1,79 @@
1
- ---
2
- title: Liyainterview
3
- emoji: 💻
4
- colorFrom: green
5
- colorTo: pink
6
- sdk: streamlit
7
- sdk_version: 1.32.1
8
- app_file: app.py
9
- pinned: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
+
3
+ # AI Interviewer - Version 0.1.2
4
+
5
+ Welcome to AI Interviewer! 👏 AI Interviewer is a cutting-edge application powered by generative AI designed to conduct mock interviews. With the ability to analyze your uploaded resume and job descriptions, AI Interviewer generates tailored questions to enhance your interview preparation. You even have the flexibility to customize your own interviewing experience!
6
+
7
+ ## Table of Contents
8
+
9
+ - [Overview](#overview)
10
+ - [Getting Started](#getting-started)
11
+ - [Features](#features)
12
+ - [Upcoming Updates](#upcoming-updates)
13
+ - [Feedback](#feedback)
14
+ - [Contact](#contact)
15
+ <!-- - [Acknowledgments](#acknowledgments) -->
16
+
17
+ ## Overview
18
+
19
+ AI Interviewer aims to revolutionize your interview preparation process. Whether you're seeking to improve your technical skills, communication abilities, or adaptability, this application can assist you. Powered by cutting-edge technology from OpenAI, FAISS, and Langchain, AI Interviewer provides a seamless experience that simulates real interview scenarios.
20
+
21
+ ## Getting Started
22
+
23
+ To begin your AI Interviewer experience, follow these simple steps:
24
+
25
+ 1. **Select Interview Type:** Choose from the following interview screens:
26
+ - **Homepage:** Overview of AI Interviewer.
27
+ - **Behavioral Screen:** Assess your behavioral skills.
28
+ - **Professional Screen:** Evaluate your technical skills.
29
+ - **Resume Screen:** Review your uploaded resume.
30
+
31
+ 2. **Customize Your Experience:** Tailor your interview by uploading your resume and providing job descriptions.
32
+
33
+ 3. **Choose Interaction Style:** Opt for your preferred interaction style, whether it's through chat or voice.
34
+
35
+ 4. **Start Interviewing:** Begin the interview by introducing yourself and responding to AI-generated questions.
36
+
37
+ ## Features
38
+
39
+ - **Personalized Questions:** AI Interviewer generates interview questions customized to your uploaded resume and job descriptions.
40
+
41
+ - **Multiple Screens:** Access different screens for behavioral, professional, and resume-related interview aspects.
42
+
43
+ - **Interactive Experience:** Engage in a conversation with the AI interviewer, enhancing the realism of the interview process.
44
+
45
+ - **Easy Refresh:** Initiate a new interview session simply by refreshing the page.
46
+
47
+ - **Choice of Interaction:** Select between chat-based or voice-based interaction styles for your interviews.
48
+
49
+ ## Upcoming Updates
50
+
51
+ We are constantly working to improve AI Interviewer and bring you new features. In the pipeline:
52
+
53
+ - Enhanced AI capabilities for even more realistic interviews.
54
+ - Expanded question database for a wider range of industries and roles.
55
+ - Improved voice interaction for a seamless experience.
56
+
57
+ ## Feedback
58
+
59
+ We highly value your feedback! Your insights can help us enhance AI Interviewer. Please take a moment to fill out our [Feedback Form](https://docs.google.com/forms/d/13f4q03bk4lD7sKR7qZ8UM1lQDo6NhRaAKv7uIeXHEaQ/viewform?edit_requested=true).
60
+
61
+ ## Contact
62
+
63
+ ## Contact
64
+
65
+ - GitHub: [jiatastic](https://github.com/jiatastic)
66
+
67
+ <!-- ## Acknowledgments
68
+
69
+ AI Interviewer is powered by a blend of advanced technologies:
70
+
71
+ - OpenAI: Providing the generative AI capabilities.
72
+ - FAISS: Enhancing search and retrieval capabilities.
73
+ - Langchain: Facilitating natural language interactions.
74
+
75
+ The application is proudly built with [Streamlit](https://streamlit.io/).
76
+
77
  ---
78
 
79
+ Remember, AI Interviewer is your partner in preparing for your future interviews. Sharpen your skills, boost your confidence, and seize those career opportunities with confidence! 🚀 -->
icon.png ADDED
initialization.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from langchain.embeddings import OpenAIEmbeddings
3
+ from langchain.vectorstores import FAISS
4
+ from langchain.text_splitter import NLTKTextSplitter
5
+ from langchain.memory import ConversationBufferMemory
6
+ from langchain.chains import RetrievalQA, ConversationChain
7
+ from prompts.prompts import templates
8
+ from langchain.prompts.prompt import PromptTemplate
9
+ from langchain.chat_models import ChatOpenAI
10
+ from PyPDF2 import PdfReader
11
+ from prompts.prompt_selector import prompt_sector
12
+ def embedding(text):
13
+ """embeddings"""
14
+ text_splitter = NLTKTextSplitter()
15
+ texts = text_splitter.split_text(text)
16
+ # Create emebeddings
17
+ embeddings = OpenAIEmbeddings()
18
+ docsearch = FAISS.from_texts(texts, embeddings)
19
+ return docsearch
20
+
21
+ def resume_reader(resume):
22
+ pdf_reader = PdfReader(resume)
23
+ text = ""
24
+ for page in pdf_reader.pages:
25
+ text += page.extract_text()
26
+ return text
27
+
28
+ def initialize_session_state(template=None, position=None):
29
+ """ initialize session states """
30
+ if 'jd' in st.session_state:
31
+ st.session_state.docsearch = embedding(st.session_state.jd)
32
+ else:
33
+ st.session_state.docsearch = embedding(resume_reader(st.session_state.resume))
34
+
35
+ #if 'retriever' not in st.session_state:
36
+ st.session_state.retriever = st.session_state.docsearch.as_retriever(search_type="similarity")
37
+ #if 'chain_type_kwargs' not in st.session_state:
38
+ if 'jd' in st.session_state:
39
+ Interview_Prompt = PromptTemplate(input_variables=["context", "question"],
40
+ template=template)
41
+ st.session_state.chain_type_kwargs = {"prompt": Interview_Prompt}
42
+ else:
43
+ st.session_state.chain_type_kwargs = prompt_sector(position, templates)
44
+ #if 'memory' not in st.session_state:
45
+ st.session_state.memory = ConversationBufferMemory()
46
+ # interview history
47
+ #if "history" not in st.session_state:
48
+ st.session_state.history = []
49
+ # token count
50
+ #if "token_count" not in st.session_state:
51
+ st.session_state.token_count = 0
52
+ #if "guideline" not in st.session_state:
53
+ llm = ChatOpenAI(
54
+ model_name="gpt-3.5-turbo",
55
+ temperature=0.6, )
56
+ st.session_state.guideline = RetrievalQA.from_chain_type(
57
+ llm=llm,
58
+ chain_type_kwargs=st.session_state.chain_type_kwargs, chain_type='stuff',
59
+ retriever=st.session_state.retriever, memory=st.session_state.memory).run(
60
+ "Create an interview guideline and prepare only one questions for each topic. Make sure the questions tests the technical knowledge")
61
+ # llm chain and memory
62
+ #if "screen" not in st.session_state:
63
+ llm = ChatOpenAI(
64
+ model_name="gpt-3.5-turbo",
65
+ temperature=0.8, )
66
+ PROMPT = PromptTemplate(
67
+ input_variables=["history", "input"],
68
+ template="""I want you to act as an interviewer strictly following the guideline in the current conversation.
69
+
70
+ Ask me questions and wait for my answers like a real person.
71
+ Do not write explanations.
72
+ Ask question like a real person, only one question at a time.
73
+ Do not ask the same question.
74
+ Do not repeat the question.
75
+ Do ask follow-up questions if necessary.
76
+ You name is GPTInterviewer.
77
+ I want you to only reply as an interviewer.
78
+ Do not write all the conversation at once.
79
+ If there is an error, point it out.
80
+
81
+ Current Conversation:
82
+ {history}
83
+
84
+ Candidate: {input}
85
+ AI: """)
86
+ st.session_state.screen = ConversationChain(prompt=PROMPT, llm=llm,
87
+ memory=st.session_state.memory)
88
+ #if "feedback" not in st.session_state:
89
+ llm = ChatOpenAI(
90
+ model_name = "gpt-3.5-turbo",
91
+ temperature = 0.5,)
92
+ st.session_state.feedback = ConversationChain(
93
+ prompt=PromptTemplate(input_variables = ["history", "input"], template = templates.feedback_template),
94
+ llm=llm,
95
+ memory = st.session_state.memory,
96
+ )
packages.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ xdg-utils
2
+ w3m
requirements.txt ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ langchain
2
+ PyPDF2
3
+ openai
4
+ wave
5
+ streamlit==1.25.0
6
+ tiktoken
7
+ nltk
8
+ #azure-cognitiveservices-speech
9
+ audio_recorder_streamlit
10
+ streamlit-option-menu
11
+ streamlit-lottie
12
+ faiss-cpu
13
+ boto3
14
+ Ipython