File size: 896 Bytes
3518392
 
 
 
a284aff
3518392
 
 
 
 
 
 
 
a284aff
 
 
 
3518392
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from flask import Flask, request, jsonify

app = Flask(__name__)

# Dishes dictionary
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)