Purpose of the Application
In the past few years, artificial intelligence has experienced extremely rapid development and widespread application in various fields. A particular boost to its popularity was the public release of ChatGPT on November 30, 2022, after which AI systems became available to a large number of users. Today, artificial intelligence is used in numerous fields, such as programming, digital content creation, data analysis, education, and many others.
Precisely because of the increasing presence of artificial intelligence, the idea for developing this application emerged. The goal of the application is not to replace a professional psychologist, but to offer a digital tool that can provide the user with an initial assessment of their psychological state based on the answers entered into the questionnaire. After completing the questionnaire, the answers are sent to a local AI model that analyzes them, evaluates them according to predefined criteria, and displays the results and the achieved score to the user. The use of a local AI model additionally contributes to privacy protection because the data is processed on the user’s device, without the need to send it to external servers.
Application Operation
Concept
The application is intended for conducting a psychological personality analysis with the help of artificial intelligence. It is implemented as a web application that allows the user to complete a questionnaire consisting of 72 questions divided into 15 psychological categories. The categories cover different aspects of personality and ways of thinking, such as empathy, guilt, trust, love, meaning of life, free will, loneliness, and others.
After the user answers all the questions, the collected answers are sent to the local AI model. The model analyzes the content of the answers and generates an assessment and a corresponding score for each psychological category. In addition to numerical results, the AI also creates a textual analysis explaining on the basis of which answers it reached certain conclusions. In this way, the user receives a detailed overview of all analyzed areas of their personality.
The use of a local AI model enables data processing on the computer or server on which the application is running, thereby increasing user privacy and reducing the need to send sensitive data to external services.
Application Structure
The application is developed according to the client–server model and consists of two interconnected services that together enable its proper operation.
1. Frontend
The frontend of the application is implemented using the Streamlit library. Its task is to display the user interface, enable the completion of the psychological questionnaire, and display the analysis results after processing is completed. Throughout the entire process, the user interacts exclusively with this part of the application.
2. Backend
The backend of the application is implemented as a FastAPI service. It receives the answers entered by the user through the web interface, prepares them for processing, communicates with the local AI model, and returns the analysis results to the frontend. In addition, it is responsible for data storage management and the overall application logic.
For the application to function correctly, both services must be running simultaneously. The frontend and the backend communicate with each other through HTTP requests, while the FastAPI service communicates with the local AI model Ollama. The AI model then analyzes the user’s answers and generates a psychological assessment, which is displayed in the web interface.
Steps Performed When Starting the Application
After starting the application, the user goes through several clearly defined steps, from completing the psychological questionnaire to displaying the final analysis results. During this process, the application collects the responses, prepares them for processing, checks whether previously stored results already exist, communicates with the local AI model if necessary, and finally displays a detailed analysis in both graphical and textual form. The following chapters describe each of these steps and the way in which the application processes user data.
1. Answering the Questions
The first step in the operation of the application is completing the psychological questionnaire. The user answers a total of 72 questions, with each question offering three possible answers labeled A, B, and C. Each answer represents a specific way of thinking or emotional approach and is predefined as belonging to one of the three basic personality types used by the application during the analysis.
The meaning of the individual answers is defined as follows:
- A – emotionally authentic, vulnerable, and reflective response (“human” type)
- B – rational, analytical, and emotionally detached response (“android” type)
- C – neutral or undefined response representing a combination of the previous two approaches (“neutral” type)
To ensure that the analysis covers different aspects of human personality, the questions are divided into 15 psychological categories, each examining a specific area of behavior, attitudes, or emotional experience:
- UND – Unconventional Desires
- GUI – Guilt
- LOV – Love
- PAI – Pain
- EMP – Empathy
- HAT – Hatred
- SAC – Sacrifice
- TRU – Trust
- HOP – Hope
- AWE – Awe
- FAI – Fairness
- MAP – Meaning and Purpose
- AUT – Free Will
- CUR – Curiosity
- LON – Loneliness
After the user answers all the questions, the collected responses are forwarded to the backend service, where the process of analyzing them using the local AI model begins.
2. Sending Responses for Analysis
After the user completes the questionnaire and clicks the “Analyze Responses” button, all entered responses are sent from the frontend of the application to the backend service (FastAPI) via an HTTP request. The backend then receives the responses and prepares them for processing.
The first processing step is grouping the responses according to the psychological categories to which they belong. In this way, the responses are organized into logical groups representing individual areas of analysis, such as empathy, trust, or meaning of life.
Based on these organized data, the backend generates a detailed prompt that is forwarded to the local AI model. A separate block is created for each of the 15 categories, containing the corresponding responses, their context, and the necessary analysis instructions. This structure enables the AI model to analyze each psychological domain separately, taking into account only the responses relevant to the observed category.
After the prompt has been prepared, the backend continues the process by checking the cache system to determine whether a previously generated analysis already exists for the same set of responses.
3. Cache System (Smart Storage)
Before the prepared prompt is sent to the local AI model, the application checks whether an analysis has already been generated for the same set of responses. For this purpose, an SQLite database is used as a temporary storage (cache) system.
For each completed questionnaire, a unique SHA-256 hash is generated, i.e., a digital fingerprint created from all user responses. Since the hash is unique for a specific combination of responses, it enables fast identification of identical questionnaires.
If the user enters exactly the same set of responses that has already been analyzed, the system finds the corresponding record in the cache and immediately returns the previously generated result. In this case, the analysis is not sent to the AI model, significantly reducing waiting time and system load. In the user interface, such a result is marked with the ⚡ symbol and the label “from cache”.
If no corresponding record exists, the prompt is forwarded to the local AI model for processing. After the model generates the analysis, the result is automatically stored in the SQLite database together with the corresponding SHA-256 hash so that it is available for future identical requests.
The user can delete all stored results at any time using the “Clear Cache” button located in the application’s sidebar. This deletes all records from the cache, causing every subsequent analysis to be performed again by the AI model.
4. AI Analysis
If the system does not find a previously stored analysis during the cache check, the backend sends the prepared prompt to the local AI model Nemotron Cascade 2, which runs through the Ollama platform. The model then processes the user’s responses and generates a psychological analysis.
To ensure that the analysis is as consistent as possible, the AI model receives additional information together with the user’s responses that is required for processing. This includes responses grouped by psychological categories, detailed scoring instructions, and the predefined format in which the results should be returned.
For each of the 15 psychological categories, the model assigns a score on a scale from 0 to 100, where the values have the following meaning:
- 0–33 – the responses indicate a predominantly rational, analytical, and emotionally detached way of thinking (“android” type)
- 34–67 – the responses represent a combination of rational and emotional approaches and are considered neutral
- 68–100 – the responses indicate pronounced emotional authenticity, vulnerability, and reflectiveness (“human” type)
It is important to emphasize that this scale does not represent an assessment of good or bad, nor of correct or incorrect behavior. The obtained score exclusively describes the position of the user’s responses on the continuum between an emotionally authentic and a rationally detached way of thinking.
5. Displaying the Results
After the AI model completes the analysis, the backend returns the results to the frontend of the application, where they are clearly presented to the user. The purpose of the presentation is to enable an easy understanding of the obtained scores and their meaning through a combination of graphical elements and textual explanations.
The results are displayed in several ways:
- Category visualization – Each of the 15 psychological categories is displayed using a Plotly gauge chart (semi-circular chart). The values are shown on a scale from 0 to 100, with colors gradually transitioning from blue, through yellow, to green, visually highlighting the position of the result on the scale.
- Distribution of response types – For each psychological category, the percentage of responses belonging to the human, android, and neutral types is displayed. This gives the user insight into the representation of individual response patterns within each domain.
- Textual analysis – Along with each category, a short textual explanation generated by the AI model is displayed. The analysis, typically consisting of two to three sentences, describes the results and explains the reasons for the assigned score.
- Overview of all categories – In addition to the individual results, the application displays a combined bar chart that enables comparison of all psychological categories and makes it easier to identify the areas in which certain response patterns are the most pronounced.
- Overall conclusion – At the end of the report, the AI model generates a summary of three to four sentences that combines the results of all categories and provides a general overview of the user’s profile based on the completed questionnaire.
6. Debug Panel
The application also includes a Debug mode, intended for development, testing, and troubleshooting potential errors. Debug mode can be enabled using the button located in the application’s sidebar.
When Debug mode is active, additional technical information about the communication process between the application and the AI model is available to the user. The following information is displayed:
- Sent parameters (JSON payload) – displays the complete JSON object that the backend sends to the AI model. This makes it possible to verify whether all responses and parameters have been correctly prepared before the analysis.
- Raw AI model JSON response – displays the original response returned by the AI model, without any additional processing or formatting. This makes it easier to identify possible errors in the response structure or irregularities during result generation.
- Generated cURL command – the application automatically generates a cURL command corresponding to the submitted request. This allows the same request to be easily reproduced from a terminal or another HTTP request testing tool, making development, debugging, and API verification easier.
Debug mode is primarily intended for developers and is not required during regular use of the application, as it displays only technical information related to the operation of the system.
Tested Models
To select the most suitable model for psychological analysis, several publicly available local LLM models were tested during the development of the application. Each model was tested using the same set of questions and responses, while the quality of the analysis, scoring consistency, level of explanation, and execution speed were evaluated.
| Model | Observation |
|---|---|
| Gemma 4:31B | Generates short and concise responses, usually consisting of a single sentence. The analysis is satisfactory but less detailed compared to the other models. Execution time is slightly longer due to the size of the model. |
| Qwen3.6:35B-A3B | Produced the best results during testing. It generates detailed explanations consisting of multiple sentences, effectively connects the user’s responses, and provides meaningful conclusions. The analysis is consistent and offers the most in-depth explanation of the results. |
| Mistral Small 3.2 | It was observed that the model often did not analyze the content of the responses, but instead based its conclusions on the number of individual response types. As a result, the analysis was superficial and lacked deeper explanation. |
| Llama 3.1:8B | Generates understandable explanations and relatively high-quality textual analyses. However, during scoring it often classifies predominantly android-type responses as neutral, making the final scores less accurate. |
| Nemotron Cascade 2 | Showed behavior similar to the Mistral Small 3.2 model. The analysis was often based on simply counting response types rather than their actual meaning, making the results less reliable. |
Based on the conducted testing, it can be concluded that Qwen3.6:35B-A3B achieved the best results. The model consistently generated detailed explanations, interpreted user responses effectively, and provided the most accurate assessments of the psychological categories. For this reason, it represents the most suitable choice for the professional use of this application.
On the other hand, Gemma 4:31B proved to be a good choice in situations where simplicity and clarity of the results are more important. Although its responses are shorter and less detailed, the model provides understandable analyses that may be more suitable for a broader group of users.
During testing, it was also observed that the size of the model is not directly related to the quality of the obtained results. Larger models require more computational resources and longer execution times, but they do not necessarily provide a more accurate analysis. Therefore, the selection of a model should be based on the quality of its interpretation rather than solely on the number of parameters.
Considering the obtained results, the further development of the application should be based on the Qwen3.6:35B-A3B model, with the possibility of further adapting or training it on a specialized dataset in order to improve the accuracy and consistency of the psychological analysis.
Future Development of the API
Although the application in its current form successfully performs its primary function, there are numerous possibilities for its further improvement. During development, publicly available local Large Language Models (LLMs) were used to examine whether, with appropriate instructions (prompts), they could provide sufficiently high-quality and consistent results for psychological analysis. Testing showed that such models produce useful and relevant analyses in most cases; however, occasional inconsistencies indicate the need for further improvements.
One possible direction for future development is the creation or additional training of a custom local AI model specifically designed for this type of psychological questionnaire. A model trained on a specialized dataset could provide more consistent results, explain its conclusions more accurately, and reduce the number of inconsistencies that may occur when using general-purpose LLMs.
Furthermore, through continued use of the application, it would be possible to gradually build a larger database of anonymous responses which, with appropriate privacy protection and user consent, could serve as the foundation for future adaptation and improvement of the local AI model.
The application’s architecture has been designed to allow simple modifications and extensions. The set of questions, available answers, and psychological categories can be relatively easily adapted or expanded without significant changes to the rest of the system. Thanks to its modular structure, it is also possible to integrate other local AI models or develop new types of psychological questionnaires, making the application scalable and suitable for use in various fields of psychological assessment and research.
Conclusion
The goal of this project was to develop a web application that uses a local artificial intelligence model to analyze responses to a psychological questionnaire and generate an assessment of various aspects of personality. During development, the user interface, backend service, result storage system (cache), and integration with a local LLM through the Ollama platform were successfully implemented.
The testing results showed that publicly available Large Language Models (LLMs) can provide meaningfully structured analyses and, in most cases, produce consistent and useful results. However, it was observed that the model responses are not always completely consistent. Occasional minor inconsistencies occurred, such as discrepancies between numerical scores and textual explanations or incomplete explanations of certain conclusions. Such occurrences indicate the limitations of using generally trained LLMs for specific psychological analysis tasks.
One of the more important decisions during development was the use of a local AI model instead of models available through online services. This approach allows user responses to remain on the local computer or server where the application is running, thereby increasing the level of data privacy and security. In addition, local models provide greater control over data processing and the possibility of further customization. Unlike commercial AI services, where users cannot train or significantly customize the underlying model, local models can be further adapted in the future to the specific needs of the application and trained on appropriate datasets.
Despite the identified limitations, the developed application has demonstrated that it is possible to successfully integrate a local AI model with a web application and automate the process of analyzing user responses. The project represents a solid foundation for the further development of the system and confirms the potential of applying artificial intelligence in the development of digital tools for psychological self-assessment.










