Bakalarska_praca/Backend/server.py
2024-10-12 14:08:12 +02:00

22 lines
460 B
Python

from flask import Flask, request, jsonify
from flask_cors import CORS # Импортируем CORS
from model import process_query_with_mistral
app = Flask(__name__)
CORS(app)
@app.route('/api/chat', methods=['POST'])
def chat():
data = request.get_json()
query = data.get('query', '')
response = process_query_with_mistral(query)
return jsonify(response)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)