Tarot MicroService

image info

The Tarot microservice within the Falomen app is a dynamic feature designed to offer users concise yet profound insights into their past, present, and future. This service draws on the tradition of Tarot, using a three-card spread that represents a snapshot of the querent's life journey. Each card selected by the user or randomly drawn by the AI corresponds to specific aspects of the user's life: the first card represents the past, the second card the present, and the third card the future. Leveraging advanced AI algorithms, this microservice interprets the symbolism, imagery, and traditional meanings of the Tarot cards to provide personalized readings. It combines the rich narrative of the cards with the context provided by the user to offer guidance, reflection, and predictions. This tailored approach allows users to gain insights into their current circumstances, understand the impact of past actions, and glimpse potential future outcomes. The Tarot Readings service enriches the Falomen app experience by introducing users to the depth of Tarot as a tool for introspection and decision-making. It serves as a bridge between ancient divinatory practices and modern technology, making esoteric wisdom accessible to users seeking clarity and guidance in their personal or spiritual journeys.


1) Requirements:

  • grpcio==1.62.0
  • grpcio-tools==1.59.0
  • transformers==4.34.1
  • numpy==1.23.5
  • pandas==2.0.1
  • torch==2.1.0
  • prometheus_client==0.18.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:
    • Arabic_Text_Classifier_Trained_Model Directory: Model weights trained for Arabic text classification
    • English_Text_Classifier_Trained_Model Directory: Model weights trained for English text classification
    • Turkish_Text_Classifier_Trained_Model Directory: Model weights trained for Turkish text classification
    • Persian_Text_Classifier_Trained_Model Directory: Model weights trained for Persian text classification
    • Tarot_NLG_Model: Generative llm Model Weights for Tarot Readings
  • JSON Files:
    • prompt.json: Prompt Template for Tarot_NLG_Model
    • Tarot_datasets.json: Tarot Cards General Description
  • CSV Files:
    • Tarot.csv : Tarot Cards suit Names and Numbers

4) Modules:

  • 4-1) Tarot.py

    • Methods:

      • generate_tarot_reading()
        This method is used to generate tarot reading using Tarot_NLG_Model

        Attributes:
        • Model (str): Model Path
        • tokenizer(str): Tokenizer path
        • input_text (str): propmt text

        • return (str): Tarot readings for each card

      • post_process_tarot_interpretation()
        A Method to post process the text before providing to the user.

        Attributes:
        • generated_text (str): Generated dream Analysis
        • prompt (str): Prompt Text to ask NLG for dream Analysis

        • return (str): Cleaned Text for Dream Analysis

      • Tarot_fortune()
        Tarot_fortune recieves user cards info and provides the tarot fortune readings

        Attributes:

        • input_name (str): User name input
        • input_age (int): User Age input
        • input_gender (str): User Gender Input (eg. Male, Female)
        • input_status (str): User Maritial Status (eg. Single, Married, Divorced)
        • input_ques(str): User Input Question
        • first_card (int): 1st Card Number (0~78)
        • sec_card (int): 2nd Card Number (0~78)
        • thrd_card (int): 3rd Card Number (0~78)
        • first_or(int): 1st Card Orientation (0: for Upward, 1: for Downward)
        • second_or(int): 2nd Card Orientation (0: for Upward, 1: for Downward)
        • third_or(int): 3rd Card Orientation (0: for Upward, 1: for Downward)
        • lang: User Input Question Language (fa: for Persian, ar: for Arabic, tr: for Turkish, en: for English)

        • return (str): Tarot Fortune Translated in Target Language

  • 4-2) Text_Classifier.py

    • Methods:

      • get_prediction()
        get_prediction Classifies input string into 4 categories (romance, financial, career and health)

        Attributes:
        • input_string: Input string to be categorized.
        • language: Language of Input_String (fa: for Persian, ar: for Arabic, tr: for Turkish, en: for English)

        • return: Categorized Tensor (0 for romance, 1: for financial, 2: for career, 3: for health)

  • 4-3) Zodiac.py

    • Classes:

      Zodiac

      A class to Calculate Zodiac info based on user input birth date.

      Attributes:

      • year (str): Input User Birth Year.
      • month (str): Input User Birth Month.
      • day (str): Input User Birth Day.

      • Methods:
        • get_astro_sign()
          get_astro_sign converts input birth date to relevant Zodiac Sign

          Attributes:

          • year (int): Input Birth Year as integer.
          • month (int): Input Birth Month as integer between 1 to 12
          • day (int): Input Birth Day as integer between 1 to 31

          • return (str): relevent Zodiac Sign Name

        • get_zodiac()
          get_zodiac as main function provides Zodiac info using user input birth date

          Attributes:

          • year (int): Input Birth Year as integer.
          • month (int): Input Birth Month as integer between 1 to 12
          • day (int): Input Birth Day as integer between 1 to 31
          • input_language (str): User prefered language ("fa": for Persian, "tr": for Turkish, "en": for english, "arb": for arabic,)

          • return (series): a series including [User Zodiac Sign, User Element, User Category, User High Vibrations, User Low Vibrations, Month Characteristics]