diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8df3ade Binary files /dev/null and b/.DS_Store differ diff --git a/app.py b/app.py new file mode 100644 index 0000000..9edd172 --- /dev/null +++ b/app.py @@ -0,0 +1,53 @@ +from flask import Flask, request, jsonify, render_template + +app = Flask(__name__) + +@app.route('/product-recommendation', methods=['POST']) +def product_recommendation(): + """ + Endpoint for product recommendations based on natural language queries. + Input: Form data containing 'query' (string). + Output: JSON with 'products' (array of objects) and 'response' (string). + """ + query = request.form.get('query', '') + # Process the query to find matching products + products = [] # Empty array, to be populated with product data + response = "" # Empty string, to be filled with a natural language response + return jsonify({"products": products, "response": response}) + +@app.route('/ocr-query', methods=['POST']) +def ocr_query(): + """ + Endpoint to process handwritten queries extracted from uploaded images. + Input: Form data containing 'image_data' (file, base64-encoded image or direct file upload). + Output: JSON with 'products' (array of objects) and 'response' (string). + """ + image_file = request.files.get('image_data') + # Process the image to extract text and find matching products + products = [] # Empty array, to be populated with product data + response = "" # Empty string, to be filled with a natural language response + return jsonify({"products": products, "response": response}) + +@app.route('/image-product-search', methods=['POST']) +def image_product_search(): + """ + Endpoint to identify and suggest products from uploaded product images. + Input: Form data containing 'product_image' (file, base64-encoded image or direct file upload). + Output: JSON with 'products' (array of objects) and 'response' (string). + """ + product_image = request.files.get('product_image') + # Process the product image to detect and match products + products = [] # Empty array, to be populated with product data + response = "" # Empty string, to be filled with a natural language response + return jsonify({"products": products, "response": response}) + +@app.route('/sample_response', methods=['GET']) +def sample_response(): + """ + Endpoint to return a sample JSON response for the API. + Output: JSON with 'products' (array of objects) and 'response' (string). + """ + return render_template('sample_response.html') + +if __name__ == '__main__': + app.run(debug=True) diff --git a/data/dataset.zip b/data/dataset.zip new file mode 100644 index 0000000..2939a28 Binary files /dev/null and b/data/dataset.zip differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8ab6294 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask \ No newline at end of file diff --git a/services/__init__py b/services/__init__py new file mode 100644 index 0000000..e69de29 diff --git a/templates/sample_response.html b/templates/sample_response.html new file mode 100644 index 0000000..29fb191 --- /dev/null +++ b/templates/sample_response.html @@ -0,0 +1,86 @@ + + + + + + Product Recommendations + + + +
+

Answer In Natural Language

+

Experience exceptional sound with our High-Quality Headphones, featuring advanced noise cancellation and a comfortable over-ear design, perfect for any audio enthusiast. Streamline your workspace with our Ergonomic Wireless Mouse, designed to reduce wrist strain and improve precision without the clutter of wires. Enjoy barista-level espresso at home with our Compact Espresso Machine, which combines sleek design with quick and easy operation. Stay healthy and connected with our Smart Fitness Tracker, ideal for monitoring activity levels and health metrics efficiently. Illuminate any setting with our Ultra-Bright LED Torch, providing powerful lighting solutions for outdoor enthusiasts and emergency preparedness alike

+ +

Selected Products

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Stock CodeDescriptionUnit PriceCountry
001High-Quality Headphones$50.00USA
002Ergonomic Wireless Mouse$20.00Canada
003Compact Espresso Machine$100.00United Kingdom
004Smart Fitness Tracker$30.00Australia
005Ultra-Bright LED Torch$25.00New Zealand
+
+ +