# Flask 應用程式碼 from flask import Flask, render_template, request, jsonify from trueGPT import get_response import os os.environ['SENTENCE_TRANSFORMERS_HOME'] = './.cache' app = Flask(__name__) @app.route('/') def home(): return render_template('index.html') @app.route('/get_response', methods=['POST']) def process_input(): user_input = request.json['user_input'] response = get_response(user_input) return jsonify(response=response) if __name__ == '__main__': app.run(host='0.0.0.0',port=7860, debug=True)