Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,6 +62,19 @@ def get_ingredients():
|
|
| 62 |
except Exception as e:
|
| 63 |
print(f"Error while fetching ingredients: {str(e)}") # Debug error
|
| 64 |
return jsonify({"error": f"Failed to fetch ingredients: {str(e)}"}), 500
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
if __name__ == '__main__':
|
|
|
|
| 62 |
except Exception as e:
|
| 63 |
print(f"Error while fetching ingredients: {str(e)}") # Debug error
|
| 64 |
return jsonify({"error": f"Failed to fetch ingredients: {str(e)}"}), 500
|
| 65 |
+
@app.route('/submit_ingredients', methods=['POST'])
|
| 66 |
+
def submit_ingredients():
|
| 67 |
+
data = request.json
|
| 68 |
+
ingredients = data.get('ingredients', [])
|
| 69 |
+
|
| 70 |
+
if not ingredients:
|
| 71 |
+
return jsonify({'error': 'No ingredients selected'}), 400
|
| 72 |
+
|
| 73 |
+
# You can now process the selected ingredients, store them in a database, etc.
|
| 74 |
+
print(f"Ingredients submitted: {ingredients}")
|
| 75 |
+
|
| 76 |
+
return jsonify({'success': True})
|
| 77 |
+
|
| 78 |
|
| 79 |
|
| 80 |
if __name__ == '__main__':
|