code: def serve(
      ndim_: int,
      metric: str = "ip",
      port: int = 8545,
      threads: int = 1,
      path: str = "index.usearch",
      immutable: bool = False,
  ):
      server = Server(port=port)
      index = Index(ndim=ndim_, metric=metric)
  
      if os.path.exists(path):
          if immutable:
              index.view(path)
          else:
              index.load(path)
  
      @server
      def size() -> int:
          return len(index)
  
      @server
      def ndim() -> int:
          return index.ndim
  
      @server
      def capacity() -> int:
          return index.capacity()
  
      @server
      def connectivity() -> int:
          return index.connectivity()
  
      @server
      def add_one(key: int, vector: np.ndarray):
          print("adding", key, vector)
          keys = np.array([key], dtype=Key)
          vectors = vector.flatten().reshape(vector.shape[0], 1)
          index.add(keys, vectors)
  
      @server
      def add_many(keys: np.ndarray, vectors: np.ndarray):
          index.add(keys, vectors, threads=threads)
  
      @server
      def search_one(vector: np.ndarray, count: int) -> List[dict]:
          print("search", vector, count)
          vectors = vector.reshape(vector.shape[0], 1)
          results: Matches = index.search(vectors, count)
          return results.to_list()
  
      @server
      def search_many(
          vectors: np.ndarray, count: int
      ) -> List[List[dict]]:
          results: Matches = index.search(vectors, count)
          return results.to_list()
  
      @server
      def add_ascii(key: int, string: str):
          return add_one(key, _ascii_to_vector(string))
  
      @server
      def search_ascii(string: str, count: int):
          return search_one(_ascii_to_vector(string), count)
  
      try:
          server.run()
      except KeyboardInterrupt:
          if not immutable:
              index.save(path)
  
file_path: usearch/python/usearch/server.py
imports: import os
  import argparse
  import numpy
  from typing import List
  from ucall.rich_posix import Server
  from usearch.index import Index, Matches, Key
label_desc: Use image node_id 2 for calling a global function with example usage: serve(ndim_, metric, port, threads, path, immutable) and returns: len, index, index, index, results, results, add_one, search_one