|
|
| from flask import Flask, render_template, request, jsonify |
|
|
| app = Flask(__name__, static_folder='static', template_folder='templates') |
|
|
| @app.route("/") |
| def index(): |
| return render_template("index.html") |
|
|
| @app.route("/submit", methods=["POST"]) |
| def handle_submit(): |
| product = request.form.get("product") |
| quantity = request.form.get("quantity") |
| result = f"✅ Added {quantity} units of '{{product}}' to inventory." |
| return jsonify({{"status": "success", "message": result}}) |
|
|
| @app.route("/predict", methods=["POST"]) |
| def predict(): |
| data = request.json |
| input_text = data.get("text") |
| prediction = f"🤖 Predicted value for input '{{input_text}}'" |
| return jsonify({{"result": prediction}}) |
|
|