Spaces:
Sleeping
Sleeping
File size: 697 Bytes
8eb674c ad80689 8eb674c ad80689 8eb674c ad80689 8eb674c ad80689 8eb674c ad80689 8eb674c ad80689 8eb674c ad80689 |
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__)
@app.route('/hello')
def hello():
# Return a greeting message as JSON
return jsonify({"message": "Hello, World!"})
@app.route('/calculate', methods=['POST'])
def calculate():
# Get 'a' and 'b' from request and return their sum as JSON
data = request.get_json()
a = data.get('a', 0)
b = data.get('b', 0)
return jsonify({"sum": a + b})
@app.route('/ai-ready')
def ai_ready():
return jsonify({
"message": "Day 1 of 30: Learning Python for AI",
"progress": "3%"
})
# Run the Flask application
if __name__ == '__main__':
app.run(debug=True)
|