Spaces:
Runtime error
Runtime error
Initial commit
Browse files- app.py +64 -0
- data.pkl +0 -0
- intp_vs_intj.yaml +27 -0
- requirements.txt +64 -0
app.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from random import shuffle
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
+
import pickle
|
5 |
+
|
6 |
+
DISCLAIMER = "**Caution! The questions from the test are AI generated and have not been validated by qualified persons. Therefore, interpret the test at your own risk.**"
|
7 |
+
|
8 |
+
def validate_form(*inputs):
|
9 |
+
score_map = {
|
10 |
+
"Strongly Agree": 2,
|
11 |
+
"Agree": 1,
|
12 |
+
"Neutral": 0,
|
13 |
+
"Disagree": -1,
|
14 |
+
"Strongly Disagree": -2
|
15 |
+
}
|
16 |
+
x_right = 0
|
17 |
+
x_left = 0
|
18 |
+
number_questions = len(inputs)
|
19 |
+
for input_index in range(number_questions):
|
20 |
+
checkbox = inputs[input_index]
|
21 |
+
if checkbox is None:
|
22 |
+
raise gr.Error("You forgot a checkbox!")
|
23 |
+
tag = INPUT_INFO[input_index]["tag"]
|
24 |
+
key = [k for k, v in LABELLING.items() if v == tag][0]
|
25 |
+
if key == "x_right":
|
26 |
+
x_right += score_map[checkbox]
|
27 |
+
else:
|
28 |
+
x_left += score_map[checkbox]
|
29 |
+
final = x_right + (-x_left)
|
30 |
+
fig, ax = plt.subplots()
|
31 |
+
ax.hlines(1, 2*(-number_questions), 2*number_questions, linestyles='solid')
|
32 |
+
ax.plot(final, 1, 'ro')
|
33 |
+
ax.set_xticks([2*(-number_questions), 0, 2*number_questions])
|
34 |
+
ax.set_xticklabels([LABELLING["x_left"], 'Neutral', LABELLING["x_right"]])
|
35 |
+
ax.get_yaxis().set_visible(False)
|
36 |
+
return plt
|
37 |
+
|
38 |
+
with open('data.pkl', 'rb') as f:
|
39 |
+
data = pickle.load(f)
|
40 |
+
title = data["title"]
|
41 |
+
description = data["description"]
|
42 |
+
questions_x_right_formatted = data["questions_x_right_formatted"]
|
43 |
+
questions_x_left_formatted = data["questions_x_left_formatted"]
|
44 |
+
LABELLING = data["LABELLING"]
|
45 |
+
INPUT_INFO = data["INPUT_INFO"]
|
46 |
+
combined_questions = questions_x_left_formatted + questions_x_right_formatted
|
47 |
+
shuffle(combined_questions)
|
48 |
+
with gr.Blocks() as demo:
|
49 |
+
title = gr.Markdown(f"# {title}")
|
50 |
+
description = gr.Markdown(description)
|
51 |
+
disclaimer = gr.Markdown(DISCLAIMER)
|
52 |
+
inputs = []
|
53 |
+
for question_dict in combined_questions:
|
54 |
+
question = list(question_dict.keys())[0]
|
55 |
+
tag = list(question_dict.values())[0]
|
56 |
+
checkbox = gr.inputs.Radio(choices=["Strongly Agree", "Agree", "Neutral", "Disagree", "Strongly Disagree"], label=question)
|
57 |
+
inputs.append(checkbox)
|
58 |
+
input_dict = {"question": question, "tag": tag}
|
59 |
+
INPUT_INFO.append(input_dict)
|
60 |
+
submit_button = gr.Button("Submit")
|
61 |
+
plot = gr.Plot(label="Plot")
|
62 |
+
submit_button.click(fn=validate_form, inputs=inputs, outputs=[plot], api_name="Submit")
|
63 |
+
demo.launch()
|
64 |
+
|
data.pkl
ADDED
Binary file (1.93 kB). View file
|
|
intp_vs_intj.yaml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: "INTP vs. INTJ"
|
2 |
+
dimensions: 1
|
3 |
+
x_right: "INTJ"
|
4 |
+
x_left: "INTP"
|
5 |
+
description_x_right: |
|
6 |
+
Purposeful: Every action and thought tends to serve a longer-term goal or vision.
|
7 |
+
Completion Driven: They have a compulsion to finish projects and achieve set objectives.
|
8 |
+
Order-seeking: Prefers a world that is structured and organized.
|
9 |
+
Predictive: Tries to anticipate future outcomes and prepares accordingly.
|
10 |
+
System Builders: They design and create comprehensive systems to address challenges.
|
11 |
+
Focused: INTJs often block out distractions to concentrate on their chosen task.
|
12 |
+
Single-Minded: Once they decide on a course of action, they're hard to divert.
|
13 |
+
Externally Validated: Though private, they might measure success based on external benchmarks.
|
14 |
+
Pragmatic Theorists: While they enjoy theories, they focus on those that have practical implications.
|
15 |
+
Boundary Setters: Clear about their limits and the limits they set for others.
|
16 |
+
description_x_left: |
|
17 |
+
Exploratory: They tend to roam through multiple ideas without needing to finalize or implement them.
|
18 |
+
Open-ended Thinking: INTPs might start various projects without finishing them because they're attracted to the initial exploration.
|
19 |
+
Adaptable: They're more go-with-the-flow and can change direction based on new insights.
|
20 |
+
Unstructured: They may not always have a clear plan and might procrastinate.
|
21 |
+
Skeptical: They frequently question and challenge, sometimes for the sake of understanding.
|
22 |
+
Spontaneous Insight: Might have sudden "eureka" moments after mulling over problems.
|
23 |
+
Less Concerned with Efficiency: More interested in understanding than optimizing.
|
24 |
+
Internal Validation: Less concerned with external benchmarks, and more with personal satisfaction.
|
25 |
+
Theoretical: Tend to enjoy pondering and discussing abstract concepts without needing practical application.
|
26 |
+
Less Goal-Oriented: Their process of exploration can sometimes be more important than achieving a set goal.
|
27 |
+
num_questions: 10
|
requirements.txt
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
aiofiles==23.2.1
|
2 |
+
aiohttp==3.8.5
|
3 |
+
aiosignal==1.3.1
|
4 |
+
altair==5.1.1
|
5 |
+
annotated-types==0.5.0
|
6 |
+
anyio==3.7.1
|
7 |
+
async-timeout==4.0.3
|
8 |
+
attrs==23.1.0
|
9 |
+
certifi==2023.7.22
|
10 |
+
charset-normalizer==3.2.0
|
11 |
+
click==8.1.7
|
12 |
+
contourpy==1.1.0
|
13 |
+
cycler==0.11.0
|
14 |
+
fastapi==0.103.1
|
15 |
+
ffmpy==0.3.1
|
16 |
+
filelock==3.12.3
|
17 |
+
fonttools==4.42.1
|
18 |
+
frozenlist==1.4.0
|
19 |
+
fsspec==2023.9.0
|
20 |
+
gradio==3.43.2
|
21 |
+
gradio_client==0.5.0
|
22 |
+
h11==0.14.0
|
23 |
+
httpcore==0.17.3
|
24 |
+
httpx==0.24.1
|
25 |
+
huggingface-hub==0.16.4
|
26 |
+
idna==3.4
|
27 |
+
importlib-resources==6.0.1
|
28 |
+
Jinja2==3.1.2
|
29 |
+
jsonschema==4.19.0
|
30 |
+
jsonschema-specifications==2023.7.1
|
31 |
+
kiwisolver==1.4.5
|
32 |
+
MarkupSafe==2.1.3
|
33 |
+
matplotlib==3.7.2
|
34 |
+
multidict==6.0.4
|
35 |
+
numpy==1.25.2
|
36 |
+
openai==0.28.0
|
37 |
+
orjson==3.9.7
|
38 |
+
packaging==23.1
|
39 |
+
pandas==2.1.0
|
40 |
+
Pillow==10.0.0
|
41 |
+
pydantic==2.3.0
|
42 |
+
pydantic_core==2.6.3
|
43 |
+
pydub==0.25.1
|
44 |
+
pyparsing==3.0.9
|
45 |
+
python-dateutil==2.8.2
|
46 |
+
python-dotenv==1.0.0
|
47 |
+
python-multipart==0.0.6
|
48 |
+
pytz==2023.3.post1
|
49 |
+
PyYAML==6.0.1
|
50 |
+
referencing==0.30.2
|
51 |
+
requests==2.31.0
|
52 |
+
rpds-py==0.10.2
|
53 |
+
semantic-version==2.10.0
|
54 |
+
six==1.16.0
|
55 |
+
sniffio==1.3.0
|
56 |
+
starlette==0.27.0
|
57 |
+
toolz==0.12.0
|
58 |
+
tqdm==4.66.1
|
59 |
+
typing_extensions==4.7.1
|
60 |
+
tzdata==2023.3
|
61 |
+
urllib3==2.0.4
|
62 |
+
uvicorn==0.23.2
|
63 |
+
websockets==11.0.3
|
64 |
+
yarl==1.9.2
|