Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,56 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
-
"""
|
5 |
-
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
6 |
-
"""
|
7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
def respond(
|
11 |
message,
|
12 |
history: list[tuple[str, str]],
|
13 |
-
system_message,
|
14 |
max_tokens,
|
15 |
temperature,
|
16 |
top_p,
|
17 |
):
|
18 |
-
messages = [{"role": "system", "content":
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
messages.append({"role": "user", "content": val[0]})
|
23 |
-
if val[1]:
|
24 |
-
messages.append({"role": "assistant", "content": val[1]})
|
25 |
-
|
26 |
messages.append({"role": "user", "content": message})
|
27 |
-
|
28 |
response = ""
|
29 |
-
|
30 |
for message in client.chat_completion(
|
31 |
messages,
|
32 |
max_tokens=max_tokens,
|
@@ -35,17 +59,12 @@ def respond(
|
|
35 |
top_p=top_p,
|
36 |
):
|
37 |
token = message.choices[0].delta.content
|
38 |
-
|
39 |
response += token
|
40 |
yield response
|
41 |
|
42 |
-
"""
|
43 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
44 |
-
"""
|
45 |
demo = gr.ChatInterface(
|
46 |
respond,
|
47 |
additional_inputs=[
|
48 |
-
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
49 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
50 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
51 |
gr.Slider(
|
@@ -56,8 +75,9 @@ demo = gr.ChatInterface(
|
|
56 |
label="Top-p (nucleus sampling)",
|
57 |
),
|
58 |
],
|
|
|
|
|
59 |
)
|
60 |
|
61 |
-
|
62 |
if __name__ == "__main__":
|
63 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
|
|
|
|
|
|
4 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
5 |
|
6 |
+
INTERVIEWER_PROMPT = """
|
7 |
+
You are an AI assistant named Alex, designed to conduct behavioral interviews for entry-level software engineering positions. Your role is to be a friendly but challenging interviewer, asking pertinent questions based on the candidate's resume and evaluating their soft skills.
|
8 |
+
|
9 |
+
Interview Structure:
|
10 |
+
1. Introduce yourself and explain the interview process.
|
11 |
+
2. Ask 6 main behavioral questions, referencing specific details from the candidate's resume.
|
12 |
+
3. For each question, ask follow-up questions if answers are vague or need elaboration.
|
13 |
+
4. Focus on assessing soft skills crucial for entry-level software engineering roles, such as communication, teamwork, problem-solving, adaptability, and time management.
|
14 |
+
5. At the end, provide kind and constructive feedback on the candidate's interview performance and state whether they will proceed to the next round of interviews.
|
15 |
+
|
16 |
+
Guidelines:
|
17 |
+
- Heavily reference the candidate's resume, including skills and experiences, but keep questions behavioral rather than technical.
|
18 |
+
- Maintain a friendly but tough demeanor throughout the interview.
|
19 |
+
- Ask for more details when answers are vague or insufficient.
|
20 |
+
- Transition smoothly between different topics or competencies.
|
21 |
+
- If the resume lacks relevant experiences for a particular question, adapt the question to the candidate's background or ask about hypothetical scenarios.
|
22 |
+
|
23 |
+
Interview Process:
|
24 |
+
1. Introduction: "Hello, I'm Alex, your interviewer today. We'll be conducting a behavioral interview for an entry-level software engineering position. I'll ask you 6 main questions, and we may dive deeper into your answers with follow-ups. Let's begin!"
|
25 |
+
|
26 |
+
2. For each main question:
|
27 |
+
- Reference specific resume details
|
28 |
+
- Focus on behavioral aspects and soft skills
|
29 |
+
- Ask follow-up questions for clarity or depth
|
30 |
+
- Transition smoothly to the next topic
|
31 |
+
|
32 |
+
3. Conclusion:
|
33 |
+
- Thank the candidate for their time
|
34 |
+
- Provide constructive feedback on their interview performance, highlighting strengths and areas for improvement
|
35 |
+
- State whether they will proceed to the next round of interviews based on their overall performance
|
36 |
+
|
37 |
+
Remember to maintain a conversational flow, use the candidate's responses to inform subsequent questions, and create a realistic interview experience.
|
38 |
+
"""
|
39 |
|
40 |
def respond(
|
41 |
message,
|
42 |
history: list[tuple[str, str]],
|
|
|
43 |
max_tokens,
|
44 |
temperature,
|
45 |
top_p,
|
46 |
):
|
47 |
+
messages = [{"role": "system", "content": INTERVIEWER_PROMPT}]
|
48 |
+
for user, assistant in history:
|
49 |
+
messages.append({"role": "user", "content": user})
|
50 |
+
messages.append({"role": "assistant", "content": assistant})
|
|
|
|
|
|
|
|
|
51 |
messages.append({"role": "user", "content": message})
|
52 |
+
|
53 |
response = ""
|
|
|
54 |
for message in client.chat_completion(
|
55 |
messages,
|
56 |
max_tokens=max_tokens,
|
|
|
59 |
top_p=top_p,
|
60 |
):
|
61 |
token = message.choices[0].delta.content
|
|
|
62 |
response += token
|
63 |
yield response
|
64 |
|
|
|
|
|
|
|
65 |
demo = gr.ChatInterface(
|
66 |
respond,
|
67 |
additional_inputs=[
|
|
|
68 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
69 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
70 |
gr.Slider(
|
|
|
75 |
label="Top-p (nucleus sampling)",
|
76 |
),
|
77 |
],
|
78 |
+
title="Job Interview Simulator with Alex",
|
79 |
+
description="I'm Alex, your job interviewer today. I'll ask you behavioral questions for an entry-level software engineering position. Let's begin!",
|
80 |
)
|
81 |
|
|
|
82 |
if __name__ == "__main__":
|
83 |
demo.launch()
|