Spaces:
Sleeping
Sleeping
| from openai import OpenAI | |
| import streamlit as st | |
| client = OpenAI(api_key="your_api_key") | |
| def generate_learning_plan(goal, level): | |
| prompt = f"Create a detailed, step by step from the scratch and structured 1-week learning plan for someone at {level} level who wants to learn {goal}." | |
| response = client.chat.completions.create( | |
| model="gpt-3.5-turbo", | |
| messages=[{"role": "user", "content": prompt}] | |
| ) | |
| return response['choices'][0]['message']['content'] | |
| def main(): | |
| st.title('AI Tech Mentor') | |
| st.write('If you are struggling with finding your very own carrer path and looking for a way to start your journey, this is where you are gonna make your first step.') | |
| st.write('Please enter your expected info and let us cook!') | |
| name=st.text_input('Please enter your name:') | |
| if name=='': | |
| st.warning('Please enter your name so that we can know how to help you better.') | |
| else: | |
| st.write('Hi ' +name+ ' ! Welcome to our AI Tech Mentor. We are here to help you find your own carrer path. Let us start by asking some questions.') | |
| goal=st.text_input('Please enter your goal:') | |
| if goal=='': | |
| st.warning('Please enter your goal so that we can know how to help you better.') | |
| else: | |
| st.write('Great! That such an exciting goal!') | |
| st.write('What is your current knowledge level in software development?') | |
| level=st.selectbox('What is your current knowledge level in software development?', ['I have no knowledge in software development', 'I did 5 or 10 mini projects', 'I have been working on projects for 1-2 years','Advanced']) | |
| if st.button("Create Plan"): | |
| if goal.strip() == "": | |
| st.warning("Please enter") | |
| return | |
| with st.spinner("Creating the plan...."): | |
| plan = generate_learning_plan(goal, level) | |
| st.subheader(f'\n🧠 {name} , we have created a learning plan for you based on your goal and level of knowledge. Here is what we recommend:\n{plan}') | |
| st.write(plan) | |
| if __name__ == "__main__": | |
| main() | |