gushoubang 5 tháng trước cách đây
mục cha
commit
6eed10f84d
1 tập tin đã thay đổi với 13 bổ sung0 xóa
  1. 13 0
      main.py

+ 13 - 0
main.py

@@ -30,7 +30,20 @@ def get_data():
     })
 
 # POST 上传单张图片
+@app.route('/api/upload_single_image', methods=['POST'])
+def upload_image():
+    # 获取上传的文件
+    img = request.files['img1']
+    # 保存文件
+    filePath = 'predict/' + str(uuid.uuid4()) + img.filename
 
+    img.save(filePath)
+    return jsonify({
+        "message": "上传成功",
+        "data":{
+            "img": filePath
+        }
+    })
 
 @app.route('/api/upload_single_image', methods=['POST'])
 def upload_single_image():