Browse Source

搭建项目

gushoubang 7 months ago
commit
728b23d78f
2 changed files with 28 additions and 0 deletions
  1. BIN
      __pycache__/app.cpython-310.pyc
  2. 28 0
      app.py

BIN
__pycache__/app.cpython-310.pyc


+ 28 - 0
app.py

@@ -0,0 +1,28 @@
+from flask import Flask, request, jsonify
+
+app = Flask(__name__)
+
+
+@app.route("/")
+def home():
+    return "四维AI大模型!"
+
+
+@app.route('/msg', methods=['POST'])
+def inputMsg():
+    # 从请求中获取JSON数据
+    data = request.get_json()
+
+    # 检查是否接收到数据
+    if not data:
+        return jsonify({"error": "No data received"}), 400
+
+    # 打印接收到的消息
+    print(data['msg'])
+
+    # 返回响应
+    return jsonify({"message": "数据已接收", "received": data})
+
+
+if __name__ == '__main__':
+    app.run()