This project is a web-based application that provides food recommendations based on weather conditions, user preferences (vegetarian, non-vegetarian, or any), and cuisine type. Additionally, the app suggests popular restaurants known for specific food items in the user's locality. The backend is built with Flask and integrates AI-based recommendation logic, while the frontend is developed using React.
- Weather-Based Food Recommendations: Fetches weather data for a given city and suggests food items suited to the current weather.
- User Preferences: Allows users to specify dietary preferences (vegetarian, non-vegetarian, or any) and cuisine type.
- AI-Enhanced Recommendations: Filters and refines recommendations using trained models and AI-based logic.
- Restaurant Suggestions: Displays a list of well-known restaurants for the recommended food items in the user's locality.
- Responsive Frontend: Provides a clean and interactive UI for users to input their preferences and view recommendations.
- Flask: A lightweight Python web framework.
- scikit-learn: For AI-based filtering and recommendation logic.
- Google Generative AI API: To enhance food suggestions based on weather and user inputs.
- OpenWeatherMap API: For fetching real-time weather data.
- Google Places API: To find popular restaurants for the recommended food items in the user's locality.
- Flask-CORS: To handle cross-origin requests.
- FuzzyWuzzy: For fuzzy matching of inputs (e.g., city names, cuisine types).
- React: For building a responsive user interface.
- Axios: For making API calls to the Flask backend.
- CSS: Custom styles for a clean UI.
project-root/
│
├── backend/
│ ├── ai_recommendations.py
│ ├── app.py
│ ├── config.py
│ ├── cuisines.json
│ ├── myFood.json
│ ├── recommendations.py
│ ├── requirements.txt
│ └── .env
│
├── frontend/
│ ├── public/
│ │ └── index.html
│ ├── src/
│ │ ├── components/
│ │ │ ├── FoodRecommendation.jsx
│ │ │ └── FoodRecom.css
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── index.css
│ │ └── index.js
│ └── package.json
│
└── README.md
- Python 3.8+
- Node.js 14+
- npm or Yarn
- API Keys for:
- OpenWeatherMap API
- Google Generative AI API
- Google Places API
- Navigate to the
backend
directory:cd backend python -m venv venv venv\Scripts\activate
- Install Python dependencies:
pip install -r requirements.txt pip install --upgrade Flask Werkzeug pip install flask-cors pip install python-Levenshtein
- Set up the
.env
file: Create a.env
file in thebackend
directory with the following keys:WEATHER_API_KEY=<Your_OpenWeatherMap_API_Key> GENAI_API_KEY=<Your_Generative_AI_API_Key> PLACES_API_KEY=<Your_Google_Places_API_Key> CORS_ORIGIN=http://localhost:3000
- Run the Flask application:
The backend will run on
python app.py
http://127.0.0.1:5000
.
- Navigate to the
frontend
directory:cd frontend
- Install dependencies:
npm i
- Run the React application:
The frontend will run on
npm start
http://localhost:3000
.
- Open the browser and navigate to
http://localhost:3000
. - Enter a city name and specify your preferences:
- Dietary preference (vegetarian, non-vegetarian, or any).
- Cuisine type (e.g., Indian, Continental, etc.).
- Click on the "Get Recommendations" button.
- View the list of recommended food items and popular restaurants in your locality for those items.
flask
flask-cors
requests
scikit-learn
google-generativeai
google-places
python-dotenv
fuzzywuzzy
Install all dependencies via:
pip install -r requirements.txt
react
axios
Install all dependencies via:
npm install
- Input:
- City:
New York
- Preference:
Veg
- Cuisine Type:
Indian
- City:
- Backend Process:
- Fetch weather data for New York.
- Use the weather and user inputs to request food suggestions from the Generative AI API.
- Filter and refine results using the trained AI model.
- Use Google Places API to find popular restaurants for the recommended food items in New York.
- Output:
- A list of vegetarian Indian food items suitable for the current weather in New York.
- Suggested restaurants in New York known for these food items.
Transforms textual food data into numerical representations for efficient analysis.
Measures similarity between user preferences and available food recommendations.
Handles imperfect user inputs for better robustness.
Contributions are welcome! Feel free to open issues or submit pull requests.