Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
import os
|
2 |
import requests
|
3 |
import streamlit as st
|
4 |
-
from
|
5 |
import asyncio
|
6 |
|
7 |
# Ensure you have the correct API URL for Groq and the key is set
|
8 |
GROQ_API_URL = "https://api.groq.com/v1/completions" # Replace with the actual endpoint if different
|
9 |
-
API_KEY = os.environ.get("
|
10 |
|
11 |
if not API_KEY:
|
12 |
raise ValueError("API key is missing. Make sure to set the GROQ_API_KEY environment variable.")
|
@@ -33,9 +33,8 @@ def get_opportunities(user_query):
|
|
33 |
|
34 |
# Function to translate text into the selected language (async version)
|
35 |
async def translate_text(text, target_language):
|
36 |
-
|
37 |
-
translated
|
38 |
-
return translated.text
|
39 |
|
40 |
# Streamlit App Interface
|
41 |
st.set_page_config(page_title="AI-Powered Opportunity Finder", page_icon=":bulb:", layout="wide")
|
@@ -56,14 +55,14 @@ st.sidebar.header("Ask the AI Chatbot for Opportunities")
|
|
56 |
|
57 |
# Language selection
|
58 |
languages = {
|
59 |
-
"English": "
|
60 |
-
"Spanish": "
|
61 |
-
"French": "
|
62 |
-
"German": "
|
63 |
-
"Italian": "
|
64 |
-
"Chinese": "
|
65 |
-
"Japanese": "
|
66 |
-
"Urdu": "
|
67 |
}
|
68 |
|
69 |
selected_language = st.sidebar.selectbox("Select your preferred language:", list(languages.keys()))
|
@@ -112,7 +111,7 @@ if st.button("Send"):
|
|
112 |
# Add a footer with contact info and clickable links
|
113 |
st.markdown("""
|
114 |
<footer style="text-align:center; padding: 20px; font-size: 1rem; background-color: #f0f0f5;">
|
115 |
-
<p>Powered by Groq, Google Translate, and Streamlit</p>
|
116 |
<p>For more opportunities, visit:</p>
|
117 |
<ul style="list-style-type:none; padding: 0;">
|
118 |
<li><a href="https://www.groq.com" target="_blank">Groq - AI Solutions</a></li>
|
|
|
1 |
import os
|
2 |
import requests
|
3 |
import streamlit as st
|
4 |
+
from deep_translator import GoogleTranslator
|
5 |
import asyncio
|
6 |
|
7 |
# Ensure you have the correct API URL for Groq and the key is set
|
8 |
GROQ_API_URL = "https://api.groq.com/v1/completions" # Replace with the actual endpoint if different
|
9 |
+
API_KEY = os.environ.get("GROQ_API_KEY")
|
10 |
|
11 |
if not API_KEY:
|
12 |
raise ValueError("API key is missing. Make sure to set the GROQ_API_KEY environment variable.")
|
|
|
33 |
|
34 |
# Function to translate text into the selected language (async version)
|
35 |
async def translate_text(text, target_language):
|
36 |
+
translated = GoogleTranslator(source='auto', target=target_language).translate(text)
|
37 |
+
return translated
|
|
|
38 |
|
39 |
# Streamlit App Interface
|
40 |
st.set_page_config(page_title="AI-Powered Opportunity Finder", page_icon=":bulb:", layout="wide")
|
|
|
55 |
|
56 |
# Language selection
|
57 |
languages = {
|
58 |
+
"English": "en",
|
59 |
+
"Spanish": "es",
|
60 |
+
"French": "fr",
|
61 |
+
"German": "de",
|
62 |
+
"Italian": "it",
|
63 |
+
"Chinese": "zh",
|
64 |
+
"Japanese": "ja",
|
65 |
+
"Urdu": "ur"
|
66 |
}
|
67 |
|
68 |
selected_language = st.sidebar.selectbox("Select your preferred language:", list(languages.keys()))
|
|
|
111 |
# Add a footer with contact info and clickable links
|
112 |
st.markdown("""
|
113 |
<footer style="text-align:center; padding: 20px; font-size: 1rem; background-color: #f0f0f5;">
|
114 |
+
<p>Powered by Groq, Google Translate (deep-translator), and Streamlit</p>
|
115 |
<p>For more opportunities, visit:</p>
|
116 |
<ul style="list-style-type:none; padding: 0;">
|
117 |
<li><a href="https://www.groq.com" target="_blank">Groq - AI Solutions</a></li>
|