Coffee MicroService

image info

The Coffee Reading microservice within the Falomen app introduces a digital adaptation of the ancient practice of tasseography, or coffee cup reading, to the realm of AI-based fortune telling. This feature allows users to explore insights and predictions derived from the patterns left by coffee grounds in a cup. Traditionally, this practice involves interpreting symbols and patterns formed by grounds at the bottom of a coffee cup to predict the future and uncover hidden messages about the querent's life. In the digital format provided by Falomen, users can either upload images of their coffee cups or simulate a coffee reading experience within the app. The AI algorithms then analyze the shapes and patterns visible in the coffee grounds, employing a vast database of symbol meanings and interpretations to generate personalized readings. These interpretations might cover various aspects of the user's life, such as emotional well-being, upcoming challenges or opportunities, and potential outcomes of current endeavors. The Coffee Reading microservice marries the charm and mystique of traditional divination practices with the precision and accessibility of modern technology. It offers users a unique and engaging way to engage with fortune telling, providing insights that might help them navigate their life paths with a blend of curiosity and intuition. This feature not only expands the scope of Falomen's offerings but also introduces users to diverse cultural practices of divination, enriched by AI's analytical capabilities.


1) Requirements:

  • tensorflow==2.12.0
  • keras==2.12.0
  • numpy==1.23.5
  • ultralytics==8.0.110
  • Pillow==10.0.0
  • pillow_heif==0.11.1
  • grpcio-tools==1.59.0
  • split_image==2.0.1
  • prometheus_client==0.18.0
  • opencv_contrib_python==4.7.0.72
  • opencv_python_headless==4.7.0.72
  • matplotlib==3.7.1
  • Langchain==0.0.325
  • grpcio==1.62.0
  • grpcio-reflection==1.62.0

2) API Documentation:

3) Assets:

  • gRPC Proto Files:
    • Falomen.proto
    • Falomen_pb2.py
    • Falomen_pb2_grpc.py
  • Language Models:
    • Coffee_Classifier_Trained_Model Directory: Model weights trained for Coffee image Classification
    • Coffee_Detection_Trained_Model Directory: Model weights trained for Coffee image segmentation
    • Signs Directory: PNG files used for pattern detection
    • Coffee_NLG_Model: Generative llm Model Weights for Coffee Readings

4) Modules:

  • 4-1) Coffee_Classifier.py

    • Methods:

      image_classification()
      This method is used to do classification on user input image

      Attributes:

      * image_path (str): Path to the user coffee cup image
      * return (binary): 0: Image is not a Coffee cup image, 1: Image is a cofee cup image.

  • 4-2) Coffee_Detection.py

    • Methods:

      Coffee_cup_detect()
      This method is used to do image segmentation and cropping the coffe cup image

      Attributes:

      * image_path (str): Path to the user coffee cup image
      * return (str): path to the saved segmented and cropped image

  • 4-3) Coffee_Preprocess.py

    • Methods:

      Image_Preprocess()
      This Method is used to do some pre processes on the user image.

      Attributes:

      * image_path (str): Path to the user coffee cup image
      * User_ID (str): Unique user ID

      * return (str): path to the saved image after pre proccessing

  • 4-4) Coffee_TemplateMatching_SIFT.py

    • Classes:

      Template
      This class is used to define templates used for pattern matching

      • Methods:

        • template_matching()
          This method is used to find matching templates in the coffee image with similarity more than a threshold.

          Attributes:
          • image_path (str): Path to the cropped coffee cup image
          • return (list): List of detected patterns name

  • 4-5) NLG_Model.py

    • Methods:

      • create_prompt()
        This method is used to create required prompt to NLG Model

        Attributes:
        • return (str): Prompt Template

      • load_model()
        This function is used to load the NLG Model

        Attributes:
        • return (llm-chain): llm chain

      • get_dream_interpretation()
        Main Coffee Reading Function

        Attributes:
        • Dream_text (str): User Dream Text
        • return (str): Raw Dream Analysis Result

  • 4-6) minio_client.py

    • Methods:

      • upload_file_to_minio()
        This method is used to upload files to minio Storage

        Attributes:
        • bucket_name (str): Bucket name on minio storage
        • object_name (str): Object name on minio storage
        • file_path (str): File Path on Local Storage
        • return (str): urn of uploaded file on minio storage

      • download_file_from_minio()
        This Methos is used to download files from minio Storage

        Attributes:
        • bucket_name (str): Bucket name on minio storage
        • object_name (str): Object name on minio storage
        • file_path (str): Path to save downloaded file on Local Storage
        • return (str): urn of downloaded file on minio storage