Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,16 @@ api_key = os.getenv("GROQ_API_KEY")
|
|
| 10 |
# Initialize the Groq client
|
| 11 |
client = Groq(api_key=api_key)
|
| 12 |
|
| 13 |
-
# Define the
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Function to fetch chatbot completion from Groq API
|
| 17 |
def get_response(query):
|
|
@@ -26,11 +34,11 @@ def get_response(query):
|
|
| 26 |
return response
|
| 27 |
|
| 28 |
def main():
|
| 29 |
-
st.title("
|
| 30 |
|
| 31 |
-
# Let the user choose a
|
| 32 |
-
topic = st.selectbox("Choose a
|
| 33 |
-
user_input = st.text_area("Or ask a
|
| 34 |
|
| 35 |
# If the user provides a query, we use that
|
| 36 |
query = user_input if user_input else f"Tell me about {topic}"
|
|
@@ -47,8 +55,8 @@ def main():
|
|
| 47 |
st.write(response)
|
| 48 |
|
| 49 |
# Handle unrelated queries
|
| 50 |
-
if user_input and not any(
|
| 51 |
-
st.write("Sorry, I can only answer
|
| 52 |
|
| 53 |
if __name__ == "__main__":
|
| 54 |
main()
|
|
|
|
| 10 |
# Initialize the Groq client
|
| 11 |
client = Groq(api_key=api_key)
|
| 12 |
|
| 13 |
+
# Define the business topics for the chatbot
|
| 14 |
+
business_topics = [
|
| 15 |
+
"marketing strategies", "business growth", "entrepreneurship", "sales techniques",
|
| 16 |
+
"investment strategies", "financial planning", "startup advice", "business management",
|
| 17 |
+
"leadership", "branding", "customer service", "business ethics", "negotiation",
|
| 18 |
+
"time management", "networking", "scaling a business", "business models",
|
| 19 |
+
"product development", "team building", "strategic planning", "e-commerce",
|
| 20 |
+
"online marketing", "fundraising", "small business", "business automation",
|
| 21 |
+
"social media marketing", "corporate social responsibility", "business partnerships"
|
| 22 |
+
]
|
| 23 |
|
| 24 |
# Function to fetch chatbot completion from Groq API
|
| 25 |
def get_response(query):
|
|
|
|
| 34 |
return response
|
| 35 |
|
| 36 |
def main():
|
| 37 |
+
st.title("Business Advice Chatbot")
|
| 38 |
|
| 39 |
+
# Let the user choose a business topic or type a custom query
|
| 40 |
+
topic = st.selectbox("Choose a business topic", business_topics)
|
| 41 |
+
user_input = st.text_area("Or ask a business-related question:", "")
|
| 42 |
|
| 43 |
# If the user provides a query, we use that
|
| 44 |
query = user_input if user_input else f"Tell me about {topic}"
|
|
|
|
| 55 |
st.write(response)
|
| 56 |
|
| 57 |
# Handle unrelated queries
|
| 58 |
+
if user_input and not any(topic in user_input.lower() for topic in business_topics):
|
| 59 |
+
st.write("Sorry, I can only answer business-related questions.")
|
| 60 |
|
| 61 |
if __name__ == "__main__":
|
| 62 |
main()
|