윤영준 윤영준 2023-10-31
CORS
@54e15d6dcc3519ebff6227760b07a9074a0d9dc3
action.py
--- action.py
+++ action.py
@@ -5,7 +5,6 @@
 from database.database import DB
 import torch
 from torchvision.transforms import ToTensor
-from datetime import datetime
 from model.AttentiveRNN import AttentiveRNN
 from model.Classifier import Resnet as Classifier
 from subfuction.image_crop import crop_image
@@ -36,20 +35,6 @@
     description="노드 분석을 위해 사용하는 api.",
 )
 
-
-# @Action.route('/image_summit')
-# class fileUpload(Resource):
-#     @Action.doc(responses={200: 'Success'})
-#     @Action.doc(responses={500: 'Register Failed'})
-#     def post(self):
-#         if request.method == 'POST':
-#             f = request.files['file']
-#             f.save(secure_filename(f.filename))
-#             return {
-#                 'save': 'done'  # str으로 반환하여 return
-#             }, 200
-
-
 @Action.route('/image_anal')
 class fileUpload(Resource):
     @Action.doc(responses={200: 'Success'})
@@ -68,8 +53,8 @@
 
         lat = float(data['gps_x'])
         lon = float(data['gps_y'])
-        filename = data['filename']
-        file_type = data['file_type']
+        # filename = data['filename']
+        # file_type = data['file_type']
 
         uploaded_file = request.files.get('file')
         file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
app.py
--- app.py
+++ app.py
@@ -2,15 +2,15 @@
 from flask_restx import Api
 from auth import Auth
 from action import Action
+from flask_cors import CORS
 
 app = flask.Flask(__name__)
+CORS(app)
 
 api = Api(    app,
     version='0.1',
     title="RDS",
     description="API Server",
-    terms_url="/",
-    contact="[email protected]",
     license="MIT")
 
 api.add_namespace(Auth, '/auth')
@@ -18,5 +18,5 @@
 api.add_namespace(Action, '/action')
 
 if __name__ == "__main__":
-    app.run(debug=True, host='0.0.0.0', port=8080)
+    app.run(debug=False, host='0.0.0.0', port=8000)
     print("Flask Start")
(No newline at end of file)
Add a comment
List