scooby.steve
scooby.steve

Reputation: 5

File can't be found after deploying Flask Backend Application to Render (ERROR: FileNotFoundError: [Errno 2] No such file or directory)

I am making an AI image detection application that needs to use a trained model that I have uploaded in the file directory. The application was working locally but after deployment Render says the file (basketballbest.pt) can't be found even though it is present on Github. Why is it not working?

Error message:

File "/opt/render/project/src/server/main.py", line 70, in insert_doc
    tracker = Tracker('server/models/basketballbest.pt')

FileNotFoundError: [Errno 2] No such file or directory: 'server/models/basketballbest.pt'

Github Link (file is present in that directory)

Main.py:

@app.route('/fileupload', methods=['POST'])
@cross_origin()
def insert_doc():
    # Getting and saving video file locally
    file = request.files.get('file', '')
    
    file.save(os.path.join(os.path.abspath(os.path.dirname(__file__)),app.config['UPLOAD_FOLDER'],secure_filename(file.filename)))
    fileName = file.filename

    # Read Video
    video_frames = read_video(f'server/upload_files/{fileName}')

    # Initialize Tracker
    tracker = Tracker('server/models/basketballbest.pt')

Upvotes: 0

Views: 20

Answers (0)

Related Questions