Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,9 +25,6 @@ soft_skills = {
|
|
| 25 |
"Critical Thinking": ["analyze", "think", "evaluated", "decision"]
|
| 26 |
}
|
| 27 |
|
| 28 |
-
# Chat History State
|
| 29 |
-
chat_history = []
|
| 30 |
-
|
| 31 |
# Core Chatbot Logic
|
| 32 |
def interview_bot(user_input, history):
|
| 33 |
if len(history) < len(questions):
|
|
@@ -41,7 +38,11 @@ def interview_bot(user_input, history):
|
|
| 41 |
feedback = f"✅ You highlighted soft skills: {', '.join(detected_skills)}"
|
| 42 |
else:
|
| 43 |
feedback = "ℹ️ Try mentioning soft skills like teamwork, leadership, or problem-solving."
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
else:
|
| 46 |
return history, "🎯 You've completed the interview practice!"
|
| 47 |
|
|
@@ -49,10 +50,10 @@ def interview_bot(user_input, history):
|
|
| 49 |
with gr.Blocks() as demo:
|
| 50 |
gr.Markdown("# 🤖 HR Interview Practice Chatbot")
|
| 51 |
chatbot = gr.Chatbot()
|
| 52 |
-
msg = gr.Textbox(label="Your Answer")
|
| 53 |
state = gr.State([])
|
| 54 |
btn = gr.Button("Submit")
|
| 55 |
-
|
| 56 |
def respond(user_message, chat_state):
|
| 57 |
response_state, bot_reply = interview_bot(user_message, chat_state)
|
| 58 |
chat_display = []
|
|
@@ -62,5 +63,7 @@ with gr.Blocks() as demo:
|
|
| 62 |
return chat_display, response_state
|
| 63 |
|
| 64 |
btn.click(respond, [msg, state], [chatbot, state])
|
| 65 |
-
|
| 66 |
-
gr.Markdown("👉 Practice your answers
|
|
|
|
|
|
|
|
|
| 25 |
"Critical Thinking": ["analyze", "think", "evaluated", "decision"]
|
| 26 |
}
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
# Core Chatbot Logic
|
| 29 |
def interview_bot(user_input, history):
|
| 30 |
if len(history) < len(questions):
|
|
|
|
| 38 |
feedback = f"✅ You highlighted soft skills: {', '.join(detected_skills)}"
|
| 39 |
else:
|
| 40 |
feedback = "ℹ️ Try mentioning soft skills like teamwork, leadership, or problem-solving."
|
| 41 |
+
if len(history) < len(questions):
|
| 42 |
+
next_question = f"\n\n➡️ Next Question: {questions[len(history)]}"
|
| 43 |
+
else:
|
| 44 |
+
next_question = "\n\n🎯 You've completed the interview practice!"
|
| 45 |
+
return history, feedback + next_question
|
| 46 |
else:
|
| 47 |
return history, "🎯 You've completed the interview practice!"
|
| 48 |
|
|
|
|
| 50 |
with gr.Blocks() as demo:
|
| 51 |
gr.Markdown("# 🤖 HR Interview Practice Chatbot")
|
| 52 |
chatbot = gr.Chatbot()
|
| 53 |
+
msg = gr.Textbox(label="Your Answer", placeholder="Type your answer here...")
|
| 54 |
state = gr.State([])
|
| 55 |
btn = gr.Button("Submit")
|
| 56 |
+
|
| 57 |
def respond(user_message, chat_state):
|
| 58 |
response_state, bot_reply = interview_bot(user_message, chat_state)
|
| 59 |
chat_display = []
|
|
|
|
| 63 |
return chat_display, response_state
|
| 64 |
|
| 65 |
btn.click(respond, [msg, state], [chatbot, state])
|
| 66 |
+
|
| 67 |
+
gr.Markdown("👉 Practice your answers and get soft skill feedback! Made with ❤️ using Gradio.")
|
| 68 |
+
|
| 69 |
+
demo.launch()
|