|
|
from flask import Flask, request, jsonify |
|
|
|
|
|
app = Flask(__name__) |
|
|
|
|
|
|
|
|
dishes = { |
|
|
"Italian": ["Pasta Carbonara", "Margherita Pizza", "Tiramisu"], |
|
|
"Indian": ["Butter Chicken", "Paneer Tikka", "Biryani"], |
|
|
"Chinese": ["Sweet and Sour Chicken", "Spring Rolls", "Kung Pao Chicken"], |
|
|
"Mexican": ["Tacos", "Guacamole", "Burritos"], |
|
|
"Japanese": ["Sushi", "Ramen", "Tempura"] |
|
|
} |
|
|
|
|
|
@app.route("/", methods=["GET"]) |
|
|
def home(): |
|
|
return "Welcome to the Dish Generator API! Send a POST request to /generate_dishes with a cuisine type." |
|
|
|
|
|
@app.route("/generate_dishes", methods=["POST"]) |
|
|
def generate_dishes(): |
|
|
data = request.get_json() |
|
|
prompt = data.get("cuisine", "").capitalize() |
|
|
response = dishes.get(prompt, ["No matching dishes found"]) |
|
|
return jsonify({"dishes": response}) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
app.run(host="0.0.0.0", port=7860, debug=True) |
|
|
|