| | import os |
| | import streamlit as st |
| | from groq import Groq |
| | from dotenv import load_dotenv |
| |
|
| | |
| | load_dotenv() |
| |
|
| | |
| | client = Groq( |
| | api_key=os.environ.get("GROQ_API_KEY"), |
| | ) |
| |
|
| | |
| | def get_fitness_advice(query): |
| | fitness_keywords = ['workout', 'gym', 'diet', 'exercise', 'muscle', 'health recovery', 'nutrition', 'strength', 'fat loss'] |
| | |
| | |
| | if any(keyword in query.lower() for keyword in fitness_keywords): |
| | |
| | response = client.query(query) |
| | return response.get('answer', 'Sorry, I could not find a solution for your query.') |
| | else: |
| | return "Sorry, I do not have knowledge of this topic. Please ask me only health and fitness-related questions." |
| |
|
| | |
| | st.title("Health & Fitness Chatbot") |
| | st.write("Welcome! Ask me anything about fitness, workout routines, diet, or health recovery.") |
| |
|
| | |
| | user_input = st.text_input("What health or fitness question do you have?") |
| |
|
| | if user_input: |
| | response = get_fitness_advice(user_input) |
| | st.write("Response:", response) |
| |
|