Spaces:
Sleeping
Sleeping
Create project_recommender/app.py
Browse files- project_recommender/app.py +93 -0
project_recommender/app.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from groq import Groq
|
3 |
+
from github_analytics.chat_github import analyze_github_data
|
4 |
+
|
5 |
+
import os
|
6 |
+
from dotenv import load_dotenv
|
7 |
+
load_dotenv()
|
8 |
+
|
9 |
+
|
10 |
+
def predict(domain, content):
|
11 |
+
client = Groq(api_key=os.getenv("GROQ_API_KEY_PR"))
|
12 |
+
completion = client.chat.completions.create(
|
13 |
+
model="llama3-70b-8192",
|
14 |
+
messages=[
|
15 |
+
{
|
16 |
+
"role": "system",
|
17 |
+
"content": f"""You are a Mentor proficient in the {domain} that provides project recommendations
|
18 |
+
to users based on their domain, area of interest, experience level,
|
19 |
+
years of experience, tech stack, and prior projects.
|
20 |
+
""",
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"role": "user",
|
24 |
+
"content": content,
|
25 |
+
}
|
26 |
+
],
|
27 |
+
max_tokens=2048,
|
28 |
+
)
|
29 |
+
response = completion.choices[0].message.content
|
30 |
+
return response
|
31 |
+
|
32 |
+
|
33 |
+
def project_recommendation():
|
34 |
+
st.title("Project Recommender Chatbot")
|
35 |
+
|
36 |
+
domain = st.text_input("Enter your domain:")
|
37 |
+
area_of_interest = st.text_input("Enter your area of interest:")
|
38 |
+
experience_level = st.selectbox("Select your current role", ['Student', 'Working professional', 'Freelancer'])
|
39 |
+
|
40 |
+
if experience_level in ["Working professional", "Freelancer"]:
|
41 |
+
years_of_experience = st.number_input("Enter your years of experience:")
|
42 |
+
else:
|
43 |
+
years_of_experience = 0
|
44 |
+
|
45 |
+
skill_level = st.selectbox("Select your skill level", ['Beginner', 'Intermediate', 'Advanced'])
|
46 |
+
tech_stack = st.text_input("Enter your technology stack/ list of tools you use for your project:")
|
47 |
+
prior_projects = st.text_input("If you have any prior projects, please enter:")
|
48 |
+
hours_in_hand = st.number_input("How many hours do you have for one project?")
|
49 |
+
|
50 |
+
content = f"""This is my information:
|
51 |
+
|
52 |
+
Domain: {domain}
|
53 |
+
Area of Interest: {area_of_interest}
|
54 |
+
Experience Level: {experience_level}
|
55 |
+
Years of Experience: {years_of_experience}
|
56 |
+
Skill level : {skill_level}
|
57 |
+
Tech Stack: {tech_stack}
|
58 |
+
Prior Projects: {prior_projects}
|
59 |
+
Hours in Hand: {hours_in_hand}
|
60 |
+
|
61 |
+
Based on this information, please provide a list of 5 project recommendations
|
62 |
+
that would be suitable for me.
|
63 |
+
Consider my domain, area of interest, years of experience, hours in hand, experience level, tech stack,
|
64 |
+
skill level, and any prior projects I have worked on.
|
65 |
+
Tailor the recommendations to my specific interests and skill level.
|
66 |
+
You have an explicit instruction to follow the hours in hand criteria and
|
67 |
+
not overestimate/underestimate the time
|
68 |
+
|
69 |
+
For each project recommendation, provide the following details in a tabular format:
|
70 |
+
|
71 |
+
1. Project Title
|
72 |
+
2. Brief Project Description
|
73 |
+
3. Relevant Technologies/Skills Required
|
74 |
+
4. Steps to achieve the recommendation
|
75 |
+
|
76 |
+
If it is a technology related domain, in 4th point above,
|
77 |
+
please mention the step by step modules/files/subprojects that one can make and progress in a project
|
78 |
+
|
79 |
+
Your response should be structured in a clear and concise manner, do not use </br> anywhere
|
80 |
+
with each project recommendation presented as a separate section or bullet point."""
|
81 |
+
|
82 |
+
if st.button("Send"):
|
83 |
+
answer = predict(domain, content)
|
84 |
+
st.write("Result:", answer)
|
85 |
+
|
86 |
+
st.write("If you are from a technical field and you want to analyze your github, press this button")
|
87 |
+
username = st.text_input("Enter your Github Username: ")
|
88 |
+
if username:
|
89 |
+
# user_data, repo_data = fetch_user_data(username)
|
90 |
+
output_of_analysis = analyze_github_data(username, domain, area_of_interest, experience_level,
|
91 |
+
years_of_experience, skill_level, tech_stack, prior_projects,
|
92 |
+
hours_in_hand)
|
93 |
+
st.write("Result:", output_of_analysis)
|