Dream MicroService

image info

The Dream Analysis microservice within the Falomen app serves as a specialized component designed to interpret and provide insights into the dreams of its users. Utilizing advanced AI algorithms, this microservice analyzes the content, symbols, and narratives described in user-submitted dreams to offer personalized interpretations. It draws from a comprehensive database of dream symbols and psychological theories to provide meaningful explanations that can reveal underlying emotions, thoughts, and potential future events as perceived by the app's fortune-telling framework. By inputting details about their dreams, users receive tailored reports that could help them understand their subconscious mind better, potentially uncovering hidden desires, fears, or indications of what the future holds. This service not only enhances the user experience by making it interactive and insightful but also positions Falomen as a unique application in the realm of AI-based fortune telling, by merging traditional dream interpretation methodologies with cutting-edge technology.


1) Requirements:

  • grpcio==1.62.0
  • grpcio-tools==1.59.0
  • torch==2.1.0
  • ctransformers==0.2.27
  • sacremoses==0.0.53
  • pika==1.3.2
  • grpcio-reflection==1.62.0
  • langchain==0.1.11
  • transformers==4.38.2
  • langchain-community==0.0.25
  • sentencepiece==0.1.98
  • prometheus_client==0.18.0

2) API Documentation:

3) Assets:

  • gRPC Proto Files:
    • Falomen.proto
    • Falomen_pb2.py
    • Falomen_pb2_grpc.py
  • Language Models:
    • ggm-model-q4_0.bin : Pre Trained Model for Dream Analysis

4) Modules:

  • 4-1) Dream.py

    • Classes:

      dream
      A class to Analyse dreams based on user input text.

      Attributes:
      • user_input (str): User's Dream
      • language (str): User prefered language ("fa": for Persian, "tr": for Turkish, "en": for english, "arb": for arabic,)

      • Methods:

        • translate_user_input()
          Claculates Chart Score based on Planets Placement in each subCategory

          Attributes:

          • user_input (str): User Dream Text
          • language (str): User prefered language

          • return (str): Translated User Dream Text to Target Language

        • post_process_dream_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

        • get_dream()
          get_dream as main function provides Dream Analysis based on user input text.

          Attributes:

          • Dream_Text (str): Input User Dream Text
          • input_language (str): User prefered language ("fa": for Persian, "tr": for Turkish, "en": for english, "arb": for arabic,)

          • return (str): Final Dream Analysis Text Translated in User Prefered Language

  • 4-2) 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 Dream Analysis Function

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