@html.route('/<project_name>/embed', methods=['GET'])
def plotembed(project_name):
    current_app.logger.info('Plotting patch embedding:')
    project = Project.query.filter_by(name=project_name).first()
    if (not project):
        current_app.logger.error('No project found.')
        return render_template('error.html')
    latest_modelid = get_latest_modelid(project_name)
    selected_modelid = request.args.get('modelid', default=latest_modelid, type=int)
    if ((selected_modelid > latest_modelid) or (selected_modelid < 0)):
        error_message = f'Your selected View Embed Model ID is {selected_modelid}. A valid Model ID ranges from 0 to {latest_modelid}.'
        current_app.logger.error(error_message)
        return render_template('embed.html', project_name=project_name, data='None', project_iteration=project.iteration, current_modelId=selected_modelid, error_message=error_message)
    return render_template('embed.html', project_name=project_name, project_iteration=project.iteration, current_modelId=selected_modelid)
@html.route('/<project_name>/embed', methods=['GET'])
def plotembed(project_name):
    current_app.logger.info('Plotting patch embedding:')
    project = Project.query.filter_by(name=project_name).first()
    if (not project):
        current_app.logger.error('No project found.')
        return render_template('error.html')
    latest_modelid = get_latest_modelid(project_name)
    selected_modelid = request.args.get('modelid', default=latest_modelid, type=int)
    if ((selected_modelid > latest_modelid) or (selected_modelid < 0)):
        error_message = f'Your selected View Embed Model ID is {selected_modelid}. A valid Model ID ranges from 0 to {latest_modelid}.'
        current_app.logger.error(error_message)
        return render_template('embed.html', project_name=project_name, data='None', project_iteration=project.iteration, current_modelId=selected_modelid, error_message=error_message)
    return render_template('embed.html', project_name=project_name, project_iteration=project.iteration, current_modelId=selected_modelid)