Browse Source

合并冲突

gushoubang 8 months ago
parent
commit
7be4321c22
1 changed files with 14 additions and 0 deletions
  1. 14 0
      main.py

+ 14 - 0
main.py

@@ -26,7 +26,21 @@ def get_data():
         "param": param
     })
 
+# 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
+        }
+    })
 
 # POST 上传图片
 @app.route('/api/upload_image', methods=['POST'])