File size: 1,674 Bytes
ab78615
53a1988
 
ab78615
53a1988
 
 
b670cff
51d8377
53a1988
 
 
 
 
 
 
 
51d8377
53a1988
f0837ca
53a1988
 
f0837ca
53a1988
 
 
 
f0837ca
53a1988
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import streamlit as st
import os
from groq import Groq

# Function to get recommendations from Groq AI based on user input
def get_opportunities(user_interests, user_skills, user_location):
    # Initialize Groq client using API key from environment variable
    client = Groq(api_key="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")
    
    # Call Groq's recommendation system (chat API or similar)
    response = client.chat.completions.create(
        messages=[{
            "role": "user",
            "content": f"Find me opportunities like scholarships, internships, online courses, and career advice based on my interests: {user_interests}, skills: {user_skills}, and location: {user_location}"
        }],
        model="llama-3.3-70b-versatile",  # You can adjust the model if needed
    )
    
    return response.choices[0].message.content

# Streamlit App Interface
st.title("AI-Powered Opportunity Finder for Youth")

# Collect user input for interests, skills, and location
interests = st.text_input("Enter your interests (e.g., AI, Robotics, Software Engineering):")
skills = st.text_input("Enter your skills (e.g., Python, Data Science, Web Development):")
location = st.text_input("Enter your location (e.g., Gujrat, Pakistan):")

# Button to fetch opportunities
if st.button("Find Opportunities"):
    if interests and skills and location:
        # Fetch recommendations using the Groq API
        opportunities = get_opportunities(interests, skills, location)
        
        # Display the opportunities
        st.subheader("Recommended Opportunities")
        st.write(opportunities)
    else:
        st.error("Please fill all fields.")