diff --git a/main.py b/main.py index c41c2ff..a4a8169 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,12 @@ from groq_module import groq_module_fun, chat_with_groq from helpers import jpeg_to_base64, extract_json_to_dict from flask import Flask, request, jsonify +from flask_cors import CORS # Import CORS import json import os app = Flask(__name__) +CORS(app) # Enable CORS for all routes @app.route('/recipe-maker', methods=['POST']) def recipe_maker(): @@ -14,14 +16,12 @@ def recipe_maker(): query = data.get('query') - prompt = f''' based on the following query: query: {query} generate the recipe of the best 5 dishes in the following JSON format: - {{ - "message": "" + "message": "", "Recipe":{{ "dish1": {{ "name": "", @@ -49,7 +49,6 @@ def recipe_maker(): "instructions": "" }} }} - }} ''' @@ -57,8 +56,6 @@ def recipe_maker(): print(response) recipe = extract_json_to_dict(response) - - result = { "recipe": recipe, "query": query, @@ -135,8 +132,6 @@ def meal_diet_plan(): print(response) week_diet_plan = extract_json_to_dict(response) - - result = { "meal_diet_plan": week_diet_plan, "weight": weight, @@ -197,4 +192,3 @@ def food_scan(): if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=True) -