This project is a backend implementation of a shopping assistant for the Walmart Sparkathon. It uses OpenAI's GPT model to interpret user queries and the Walmart API (via SerpAPI) to fetch product information.
Repository: https://github.com/HarshJ23/walmart-sparkathon-project
- Interprets natural language shopping queries
- Generates product suggestions based on user input
- Searches Walmart's product catalog
- Returns relevant product information
- Python
- Flask
- OpenAI API
- SerpAPI (for Walmart product search)
Follow these steps to set up the project locally:
-
Clone the repository
git clone https://github.com/HarshJ23/walmart-sparkathon-project.git cd walmart-sparkathon-project -
Navigate to the backend folder
cd backend -
Set up a virtual environment
python -m venv venv venv\Scripts\activate -
Install dependencies
pip install -r requirements.txt -
Set up environment variables
Create a
.envfile in the root directory and add the following(check .env.example for reference):OPENAI_API_KEY=your_openai_api_key SERPAPI_API_KEY=your_serpapi_api_keyReplace
your_openai_api_keyandyour_serpapi_api_keywith your actual API keys. -
Run the application
python app_v1.pyThe server should start running on
http://localhost:8000.
Send a POST request to http://localhost:8000/shop with a JSON body:
example query:
{
"text": "Plan the snacks for football watch party at my house."
}The response will include the assistant's interpretation and relevant product results.
Follow these steps to set up the frontend locally:
-
Navigate to the frontend folder
cd frontend -
Install dependencies
npm install -
Run the development server
npm run devThe frontend should now be running on
http://localhost:3000.
Access the application by opening http://localhost:3000 in your web browser. Use the interface to input your shopping queries and receive product suggestions.
Contributions are welcome! Please feel free to submit a Pull Request.
