Filip
commited on
Commit
·
ec230fe
1
Parent(s):
16a33a8
update
Browse files
app.py
CHANGED
|
@@ -21,10 +21,23 @@ def load_model():
|
|
| 21 |
|
| 22 |
return model
|
| 23 |
|
| 24 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
response = model.create_chat_completion(
|
| 26 |
messages=[
|
| 27 |
-
{"role": "
|
|
|
|
| 28 |
],
|
| 29 |
max_tokens=512,
|
| 30 |
temperature=0.7,
|
|
@@ -38,17 +51,30 @@ print("Starting model loading...")
|
|
| 38 |
model = load_model()
|
| 39 |
print("Model loaded successfully!")
|
| 40 |
|
| 41 |
-
# Create Gradio interface
|
| 42 |
demo = gr.ChatInterface(
|
| 43 |
-
fn=
|
| 44 |
-
title="
|
| 45 |
-
description="
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
# Add proper Gradio launch configuration for Spaces
|
| 50 |
demo.launch(
|
| 51 |
-
server_name="0.0.0.0",
|
| 52 |
-
server_port=7860,
|
| 53 |
-
share=False
|
| 54 |
)
|
|
|
|
| 21 |
|
| 22 |
return model
|
| 23 |
|
| 24 |
+
def generate_career_response(message, history):
|
| 25 |
+
# Enhance the prompt with career guidance context
|
| 26 |
+
enhanced_prompt = f"""As a career development advisor, help the user with their professional growth.
|
| 27 |
+
Consider:
|
| 28 |
+
1. Skill development opportunities
|
| 29 |
+
2. Industry trends
|
| 30 |
+
3. Practical next steps
|
| 31 |
+
4. Resources and learning paths
|
| 32 |
+
|
| 33 |
+
User Query: {message}
|
| 34 |
+
|
| 35 |
+
Provide a structured response with actionable advice."""
|
| 36 |
+
|
| 37 |
response = model.create_chat_completion(
|
| 38 |
messages=[
|
| 39 |
+
{"role": "system", "content": "You are a professional career advisor focused on providing practical, actionable guidance for career development."},
|
| 40 |
+
{"role": "user", "content": enhanced_prompt}
|
| 41 |
],
|
| 42 |
max_tokens=512,
|
| 43 |
temperature=0.7,
|
|
|
|
| 51 |
model = load_model()
|
| 52 |
print("Model loaded successfully!")
|
| 53 |
|
| 54 |
+
# Create Gradio interface with career-focused examples
|
| 55 |
demo = gr.ChatInterface(
|
| 56 |
+
fn=generate_career_response,
|
| 57 |
+
title="Career Growth Navigator 🚀",
|
| 58 |
+
description="""Your AI career development partner. Ask about:
|
| 59 |
+
• Skill development paths
|
| 60 |
+
• Career transition strategies
|
| 61 |
+
• Industry trends and opportunities
|
| 62 |
+
• Resume and interview preparation
|
| 63 |
+
• Professional networking advice
|
| 64 |
+
• Work-life balance
|
| 65 |
+
Let's shape your professional future together!""",
|
| 66 |
+
examples=[
|
| 67 |
+
"I'm a software developer wanting to transition into AI/ML. What skills should I focus on?",
|
| 68 |
+
"How can I improve my leadership skills in my current role?",
|
| 69 |
+
"What are the key trends in digital marketing I should be aware of?",
|
| 70 |
+
"I want to start freelancing in web development. Where should I begin?",
|
| 71 |
+
"How can I negotiate a promotion in my current position?"
|
| 72 |
+
]
|
| 73 |
)
|
| 74 |
|
| 75 |
# Add proper Gradio launch configuration for Spaces
|
| 76 |
demo.launch(
|
| 77 |
+
server_name="0.0.0.0",
|
| 78 |
+
server_port=7860,
|
| 79 |
+
share=False
|
| 80 |
)
|