saherPervaiz commited on
Commit
fd6e650
·
verified ·
1 Parent(s): c86c447

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -3
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import streamlit as st
3
  from groq import Groq
 
4
 
5
  # Function to get recommendations from Groq AI based on user input
6
  def get_opportunities(user_interests, user_skills, user_location):
@@ -24,6 +25,11 @@ def get_opportunities(user_interests, user_skills, user_location):
24
 
25
  return response.choices[0].message.content
26
 
 
 
 
 
 
27
 
28
  # Streamlit App Interface
29
  st.set_page_config(page_title="AI-Powered Opportunity Finder", page_icon=":bulb:", layout="wide")
@@ -47,6 +53,20 @@ interests = st.sidebar.text_input("Your Interests (e.g., AI, Robotics, Software
47
  skills = st.sidebar.text_input("Your Skills (e.g., Python, Data Science, Web Development):")
48
  location = st.sidebar.text_input("Your Location (e.g., Gujrat, Pakistan):")
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  # Container to display results
51
  results_container = st.container()
52
 
@@ -56,16 +76,27 @@ if st.sidebar.button("Find Opportunities"):
56
  with st.spinner("Fetching opportunities..."):
57
  # Fetch recommendations using the Groq API
58
  opportunities = get_opportunities(interests, skills, location)
 
 
 
59
 
60
  # Display the opportunities
61
  results_container.subheader("Recommended Opportunities")
62
- results_container.write(opportunities)
63
  else:
64
  st.sidebar.error("Please fill all fields.")
65
 
66
- # Add a footer with contact info
67
  st.markdown("""
68
  <footer style="text-align:center; padding: 20px; font-size: 1rem; background-color: #f0f0f5;">
69
- <p>Powered by Groq and Streamlit | Contact: support@example.com</p>
 
 
 
 
 
 
 
 
70
  </footer>
71
  """, unsafe_allow_html=True)
 
1
  import os
2
  import streamlit as st
3
  from groq import Groq
4
+ from googletrans import Translator
5
 
6
  # Function to get recommendations from Groq AI based on user input
7
  def get_opportunities(user_interests, user_skills, user_location):
 
25
 
26
  return response.choices[0].message.content
27
 
28
+ # Function to translate text into the selected language
29
+ def translate_text(text, target_language):
30
+ translator = Translator()
31
+ translated = translator.translate(text, dest=target_language)
32
+ return translated.text
33
 
34
  # Streamlit App Interface
35
  st.set_page_config(page_title="AI-Powered Opportunity Finder", page_icon=":bulb:", layout="wide")
 
53
  skills = st.sidebar.text_input("Your Skills (e.g., Python, Data Science, Web Development):")
54
  location = st.sidebar.text_input("Your Location (e.g., Gujrat, Pakistan):")
55
 
56
+ # Language selection
57
+ languages = {
58
+ "English": "English",
59
+ "Spanish": "Spanish",
60
+ "French": "French",
61
+ "German": "German",
62
+ "Italian": "Italian",
63
+ "Chinese": "Chinese",
64
+ "Japanese": "Japanese",
65
+ "Urdu": "Urdu" # Full word for Urdu
66
+ }
67
+
68
+ selected_language = st.sidebar.selectbox("Select your preferred language:", list(languages.keys()))
69
+
70
  # Container to display results
71
  results_container = st.container()
72
 
 
76
  with st.spinner("Fetching opportunities..."):
77
  # Fetch recommendations using the Groq API
78
  opportunities = get_opportunities(interests, skills, location)
79
+
80
+ # Translate the opportunities based on the selected language
81
+ translated_opportunities = translate_text(opportunities, languages[selected_language])
82
 
83
  # Display the opportunities
84
  results_container.subheader("Recommended Opportunities")
85
+ results_container.write(translated_opportunities)
86
  else:
87
  st.sidebar.error("Please fill all fields.")
88
 
89
+ # Add a footer with contact info and clickable links
90
  st.markdown("""
91
  <footer style="text-align:center; padding: 20px; font-size: 1rem; background-color: #f0f0f5;">
92
+ <p>Powered by Groq, Google Translate, and Streamlit</p>
93
+ <p>For more opportunities, visit:</p>
94
+ <ul style="list-style-type:none; padding: 0;">
95
+ <li><a href="https://www.groq.com" target="_blank">Groq - AI Solutions</a></li>
96
+ <li><a href="https://www.scholarships.com" target="_blank">Scholarships.com</a></li>
97
+ <li><a href="https://www.coursera.org" target="_blank">Coursera - Online Courses</a></li>
98
+ <li><a href="https://www.linkedin.com/jobs" target="_blank">LinkedIn Jobs</a></li>
99
+ </ul>
100
+ <p>Contact: support@example.com</p>
101
  </footer>
102
  """, unsafe_allow_html=True)