code: def recommend():
      global model, train_set
  
      if model is None:
          return "Model is not yet loaded. Please try again later.", 400
  
      params = request.args
      uid = params.get("uid")
      k = int(params.get("k", -1))
      remove_seen = params.get("remove_seen", "false").lower() == "true"
  
      if uid is None:
          return "uid is required", 400
  
      if remove_seen and train_set is None:
          return (
              "Unable to remove seen items. 'train_set' is not provided",
              400,
          )
  
      response = model.recommend(
          user_id=uid,
          k=k,
          remove_seen=remove_seen,
          train_set=train_set,
      )
  
      data = {
          "recommendations": response,
          "query": {"uid": uid, "k": k, "remove_seen": remove_seen},
      }
  
      return jsonify(data), 200
  
file_path: cornac/cornac/serving/app.py
imports: import os
  import sys
  import inspect
  from datetime import datetime, timezone
  from csv import writer
  from cornac.data import Dataset, Reader
  from cornac.eval_methods import BaseMethod
  from cornac.metrics import *
label_desc: Use image node_id 6 for calling a global function with example usage: recommend() and returns: jsonify,  int, str,  int, str,  int, str,  int