suhamemon1
commited on
Commit
•
848090a
1
Parent(s):
2a9de6f
initial commit
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .DS_Store +0 -0
- .idea/.gitignore +8 -0
- .idea/aws.xml +17 -0
- .idea/inspectionProfiles/Project_Default.xml +14 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +4 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- .idea/wrAIte.iml +10 -0
- README.md +12 -3
- __pycache__/constants.cpython-311.pyc +0 -0
- __pycache__/data_storage.cpython-311.pyc +0 -0
- __pycache__/experiment_details.cpython-311.pyc +0 -0
- __pycache__/model_generate.cpython-311.pyc +0 -0
- __pycache__/pymongo_get_database.cpython-311.pyc +0 -0
- __pycache__/questionnaire.cpython-311.pyc +0 -0
- __pycache__/utils.cpython-311.pyc +0 -0
- app.py +311 -0
- constants.py +23 -0
- data/.DS_Store +0 -0
- data/__init__.py +0 -0
- data/__pycache__/__init__.cpython-311.pyc +0 -0
- data/instructions/instr_assisted.md +1 -0
- data/instructions/instr_completed.md +1 -0
- data/instructions/instr_editresponse.md +1 -0
- data/instructions/instr_email.md +1 -0
- data/instructions/instr_proceed.md +1 -0
- data/instructions/instr_questionnaire.md +2 -0
- data/instructions/instr_shortstory.md +1 -0
- data/instructions/instr_study.md +7 -0
- data/instructions/instr_submitsuccess.md +1 -0
- data/instructions/instr_summary.md +1 -0
- data/instructions/instr_title.md +1 -0
- data/instructions/instr_unassisted.md +1 -0
- data/instructions/instr_welcome.md +7 -0
- data/problems/p_email1.md +1 -0
- data/problems/p_email10.md +1 -0
- data/problems/p_email2.md +1 -0
- data/problems/p_email3.md +1 -0
- data/problems/p_email4.md +1 -0
- data/problems/p_email5.md +1 -0
- data/problems/p_email6.md +1 -0
- data/problems/p_email7.md +1 -0
- data/problems/p_email8.md +1 -0
- data/problems/p_email9.md +1 -0
- data/problems/p_shortstory1.md +1 -0
- data/problems/p_shortstory10.md +1 -0
- data/problems/p_shortstory2.md +1 -0
- data/problems/p_shortstory3.md +1 -0
- data/problems/p_shortstory4.md +1 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
.idea/.gitignore
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
4 |
+
# Editor-based HTTP Client requests
|
5 |
+
/httpRequests/
|
6 |
+
# Datasource local storage ignored files
|
7 |
+
/dataSources/
|
8 |
+
/dataSources.local.xml
|
.idea/aws.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="accountSettings">
|
4 |
+
<option name="activeProfile" value="profile:default" />
|
5 |
+
<option name="activeRegion" value="us-west-1" />
|
6 |
+
<option name="recentlyUsedProfiles">
|
7 |
+
<list>
|
8 |
+
<option value="profile:default" />
|
9 |
+
</list>
|
10 |
+
</option>
|
11 |
+
<option name="recentlyUsedRegions">
|
12 |
+
<list>
|
13 |
+
<option value="us-west-1" />
|
14 |
+
</list>
|
15 |
+
</option>
|
16 |
+
</component>
|
17 |
+
</project>
|
.idea/inspectionProfiles/Project_Default.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<profile version="1.0">
|
3 |
+
<option name="myName" value="Project Default" />
|
4 |
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
5 |
+
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
|
6 |
+
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
7 |
+
<option name="ignoredErrors">
|
8 |
+
<list>
|
9 |
+
<option value="N803" />
|
10 |
+
</list>
|
11 |
+
</option>
|
12 |
+
</inspection_tool>
|
13 |
+
</profile>
|
14 |
+
</component>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (wrAIte) (2)" project-jdk-type="Python SDK" />
|
4 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/wrAIte.iml" filepath="$PROJECT_DIR$/.idea/wrAIte.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
.idea/wrAIte.iml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$">
|
5 |
+
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
6 |
+
</content>
|
7 |
+
<orderEntry type="jdk" jdkName="Python 3.11 (wrAIte) (2)" jdkType="Python SDK" />
|
8 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
9 |
+
</component>
|
10 |
+
</module>
|
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
title: WrAIte
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.28.3
|
8 |
app_file: app.py
|
@@ -10,3 +10,12 @@ pinned: false
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
title: WrAIte
|
3 |
+
emoji: 📉
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: blue
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.28.3
|
8 |
app_file: app.py
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
13 |
+
|
14 |
+
|
15 |
+
# Setup
|
16 |
+
|
17 |
+
## Create and activate virtual environment
|
18 |
+
1. Create venv in writingmate directory: `python3 -m venv venv`
|
19 |
+
2. Activate virtual environment: `source venv/bin/activate`
|
20 |
+
## Install requirements
|
21 |
+
`pip3 install -r requirements.txt`
|
__pycache__/constants.cpython-311.pyc
ADDED
Binary file (1.5 kB). View file
|
|
__pycache__/data_storage.cpython-311.pyc
ADDED
Binary file (2.75 kB). View file
|
|
__pycache__/experiment_details.cpython-311.pyc
ADDED
Binary file (5.83 kB). View file
|
|
__pycache__/model_generate.cpython-311.pyc
ADDED
Binary file (4.41 kB). View file
|
|
__pycache__/pymongo_get_database.cpython-311.pyc
ADDED
Binary file (2.52 kB). View file
|
|
__pycache__/questionnaire.cpython-311.pyc
ADDED
Binary file (14.7 kB). View file
|
|
__pycache__/utils.cpython-311.pyc
ADDED
Binary file (21.2 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,311 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import os
|
3 |
+
import gradio as gr
|
4 |
+
from matplotlib import pyplot as plt
|
5 |
+
|
6 |
+
from pymongo_get_database import MongoDBManager
|
7 |
+
from utils import process_markdown, save_answer, randomly_select_prompts, generate_unassisted_question, \
|
8 |
+
generate_assisted_question, randomize_questions
|
9 |
+
|
10 |
+
from experiment_details import problem_topics, problems_per_topic, writing_skills_questions
|
11 |
+
from questionnaire import generate_questionnaire
|
12 |
+
from data import problems
|
13 |
+
from datetime import datetime
|
14 |
+
from data_storage import store_user_data
|
15 |
+
import uuid
|
16 |
+
|
17 |
+
mongo_manager = MongoDBManager()
|
18 |
+
|
19 |
+
user_id = str(uuid.uuid4())
|
20 |
+
mongo_manager.create_user_record(user_id)
|
21 |
+
# radio button and button rendering: https://www.gradio.app/docs/radio
|
22 |
+
questionnaire_results = {
|
23 |
+
'Demographic Details': {},
|
24 |
+
'User Capabilities': {},
|
25 |
+
'Relationship to System': {},
|
26 |
+
'System Output Preferences': {}
|
27 |
+
}
|
28 |
+
question_answers = {
|
29 |
+
'q1': {
|
30 |
+
'Response': None,
|
31 |
+
'Assistance': None,
|
32 |
+
'CompletionTime': None,
|
33 |
+
'StartTime': None,
|
34 |
+
'EndTime': None
|
35 |
+
},
|
36 |
+
'q2': {
|
37 |
+
'Response': None,
|
38 |
+
'Assistance': None,
|
39 |
+
'CompletionTime': None,
|
40 |
+
'StartTime': None,
|
41 |
+
'EndTime': None
|
42 |
+
},
|
43 |
+
'q3': {
|
44 |
+
'Response': None,
|
45 |
+
'Assistance': None,
|
46 |
+
'CompletionTime': None,
|
47 |
+
'StartTime': None,
|
48 |
+
'EndTime': None
|
49 |
+
},
|
50 |
+
'q4': {
|
51 |
+
'Response': None,
|
52 |
+
'Assistance': None,
|
53 |
+
'CompletionTime': None,
|
54 |
+
'StartTime': None,
|
55 |
+
'EndTime': None
|
56 |
+
},
|
57 |
+
'q5': {
|
58 |
+
'Response': None,
|
59 |
+
'Assistance': None,
|
60 |
+
'CompletionTime': None,
|
61 |
+
'StartTime': None,
|
62 |
+
'EndTime': None
|
63 |
+
},
|
64 |
+
'q6': {
|
65 |
+
'Response': None,
|
66 |
+
'Assistance': None,
|
67 |
+
'CompletionTime': None,
|
68 |
+
'StartTime': None,
|
69 |
+
'EndTime': None
|
70 |
+
},
|
71 |
+
'q7': {
|
72 |
+
'Response': None,
|
73 |
+
'Assistance': None,
|
74 |
+
'CompletionTime': None,
|
75 |
+
'StartTime': None,
|
76 |
+
'EndTime': None
|
77 |
+
},
|
78 |
+
'q8': {
|
79 |
+
'Response': None,
|
80 |
+
'Assistance': None,
|
81 |
+
'CompletionTime': None,
|
82 |
+
'StartTime': None,
|
83 |
+
'EndTime': None
|
84 |
+
},
|
85 |
+
}
|
86 |
+
|
87 |
+
with gr.Blocks(title="wrAIte") as demo:
|
88 |
+
with gr.Column("Survey Complete", render=True, visible=False) as completed_screen:
|
89 |
+
instr_complete = process_markdown(False, 'instr_completed.md')
|
90 |
+
survey_complete = gr.Markdown(value=instr_complete)
|
91 |
+
|
92 |
+
questionnaire = generate_questionnaire(questionnaire_results, completed_screen, user_id)
|
93 |
+
questionnaire.render()
|
94 |
+
|
95 |
+
with gr.Column("", render=True, visible=False) as assessment:
|
96 |
+
selected_questions = randomly_select_prompts()
|
97 |
+
question_prompts = randomize_questions(selected_questions)
|
98 |
+
|
99 |
+
|
100 |
+
def next_q8():
|
101 |
+
question_answers['q8']['EndTime'] = datetime.now().isoformat()
|
102 |
+
question_answers['q8']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q8']['EndTime']) -
|
103 |
+
datetime.fromisoformat(question_answers['q8']['StartTime']))
|
104 |
+
store_user_data(user_id, "questions", question_answers)
|
105 |
+
mongo_manager.update_question_answers(user_id, question_answers)
|
106 |
+
return {
|
107 |
+
question8: gr.update(visible=False),
|
108 |
+
questionnaire: gr.update(visible=True)
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
def next_q7():
|
113 |
+
question_answers['q7']['EndTime'] = datetime.now().isoformat()
|
114 |
+
question_answers['q7']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q7']['EndTime']) -
|
115 |
+
datetime.fromisoformat(question_answers['q7']['StartTime']))
|
116 |
+
question_answers['q8']['StartTime'] = datetime.now().isoformat()
|
117 |
+
return {
|
118 |
+
question7: gr.update(visible=False),
|
119 |
+
question8: gr.update(visible=True)
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
def next_q6():
|
124 |
+
question_answers['q6']['EndTime'] = datetime.now().isoformat()
|
125 |
+
question_answers['q6']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q6']['EndTime']) -
|
126 |
+
datetime.fromisoformat(question_answers['q6']['StartTime']))
|
127 |
+
question_answers['q7']['StartTime'] = datetime.now().isoformat()
|
128 |
+
return {
|
129 |
+
question6: gr.update(visible=False),
|
130 |
+
question7: gr.update(visible=True)
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
def next_q5():
|
135 |
+
question_answers['q5']['EndTime'] = datetime.now().isoformat()
|
136 |
+
question_answers['q5']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q5']['EndTime']) -
|
137 |
+
datetime.fromisoformat(question_answers['q5']['StartTime']))
|
138 |
+
question_answers['q6']['StartTime'] = datetime.now().isoformat()
|
139 |
+
return {
|
140 |
+
question5: gr.update(visible=False),
|
141 |
+
question6: gr.update(visible=True)
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
def next_q4():
|
146 |
+
question_answers['q4']['EndTime'] = datetime.now().isoformat()
|
147 |
+
question_answers['q4']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q4']['EndTime']) -
|
148 |
+
datetime.fromisoformat(question_answers['q4']['StartTime']))
|
149 |
+
question_answers['q5']['StartTime'] = datetime.now().isoformat()
|
150 |
+
return {
|
151 |
+
question4: gr.update(visible=False),
|
152 |
+
question5: gr.update(visible=True)
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
def next_q3():
|
157 |
+
question_answers['q3']['EndTime'] = datetime.now().isoformat()
|
158 |
+
question_answers['q3']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q3']['EndTime']) -
|
159 |
+
datetime.fromisoformat(question_answers['q3']['StartTime']))
|
160 |
+
question_answers['q4']['StartTime'] = datetime.now().isoformat()
|
161 |
+
return {
|
162 |
+
question3: gr.update(visible=False),
|
163 |
+
question4: gr.update(visible=True)
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
def next_q2():
|
168 |
+
question_answers['q2']['EndTime'] = datetime.now().isoformat()
|
169 |
+
question_answers['q2']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q2']['EndTime']) -
|
170 |
+
datetime.fromisoformat(question_answers['q2']['StartTime']))
|
171 |
+
question_answers['q3']['StartTime'] = datetime.now().isoformat()
|
172 |
+
return {
|
173 |
+
question2: gr.update(visible=False),
|
174 |
+
question3: gr.update(visible=True)
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
def next_q1():
|
179 |
+
question_answers['q1']['EndTime'] = datetime.now().isoformat()
|
180 |
+
question_answers['q1']['CompletionTime'] = str(datetime.fromisoformat(question_answers['q1']['EndTime']) -
|
181 |
+
datetime.fromisoformat(question_answers['q1']['StartTime']))
|
182 |
+
question_answers['q2']['StartTime'] = datetime.now().isoformat()
|
183 |
+
return {
|
184 |
+
question1: gr.update(visible=False),
|
185 |
+
question2: gr.update(visible=True)
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
with gr.Column("Question 8", render=True, visible=False) as question8:
|
190 |
+
next_q8_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
191 |
+
q8 = generate_assisted_question(question_prompts[7], next_q8_btn, 8, question_answers)
|
192 |
+
q8.render()
|
193 |
+
next_q8_btn.render()
|
194 |
+
next_q8_btn.click(
|
195 |
+
fn=next_q8,
|
196 |
+
inputs=[],
|
197 |
+
outputs=[question8, questionnaire]
|
198 |
+
)
|
199 |
+
with gr.Column("Question 7", render=True, visible=False) as question7:
|
200 |
+
next_q7_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
201 |
+
q7 = generate_unassisted_question(question_prompts[6], next_q7_btn, 7, question_answers)
|
202 |
+
q7.render()
|
203 |
+
next_q7_btn.render()
|
204 |
+
next_q7_btn.click(
|
205 |
+
fn=next_q7,
|
206 |
+
inputs=[],
|
207 |
+
outputs=[question7, question8]
|
208 |
+
)
|
209 |
+
with gr.Column("Question 6", render=True, visible=False) as question6:
|
210 |
+
next_q6_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
211 |
+
q6 = generate_unassisted_question(question_prompts[5], next_q6_btn, 6, question_answers)
|
212 |
+
q6.render()
|
213 |
+
next_q6_btn.render()
|
214 |
+
next_q6_btn.click(
|
215 |
+
fn=next_q6,
|
216 |
+
inputs=[],
|
217 |
+
outputs=[question6, question7]
|
218 |
+
)
|
219 |
+
with gr.Column("Question 5", render=True, visible=False) as question5:
|
220 |
+
next_q5_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
221 |
+
q5 = generate_unassisted_question(question_prompts[4], next_q5_btn, 5, question_answers)
|
222 |
+
q5.render()
|
223 |
+
next_q5_btn.render()
|
224 |
+
next_q5_btn.click(
|
225 |
+
fn=next_q5,
|
226 |
+
inputs=[],
|
227 |
+
outputs=[question5, question6]
|
228 |
+
)
|
229 |
+
with gr.Column("Question 4", render=True, visible=False) as question4:
|
230 |
+
next_q4_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
231 |
+
q4 = generate_assisted_question(question_prompts[3], next_q4_btn, 4, question_answers)
|
232 |
+
q4.render()
|
233 |
+
next_q4_btn.render()
|
234 |
+
next_q4_btn.click(
|
235 |
+
fn=next_q4,
|
236 |
+
inputs=[],
|
237 |
+
outputs=[question4, question5]
|
238 |
+
)
|
239 |
+
with gr.Column("Question 3", render=True, visible=False) as question3:
|
240 |
+
next_q3_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
241 |
+
q3 = generate_unassisted_question(question_prompts[2], next_q3_btn, 3, question_answers)
|
242 |
+
q3.render()
|
243 |
+
next_q3_btn.render()
|
244 |
+
next_q3_btn.click(
|
245 |
+
fn=next_q3,
|
246 |
+
inputs=[],
|
247 |
+
outputs=[question3, question4]
|
248 |
+
)
|
249 |
+
with gr.Column("Question 2", render=True, visible=False) as question2:
|
250 |
+
next_q2_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
251 |
+
q2 = generate_assisted_question(question_prompts[1], next_q2_btn, 2, question_answers)
|
252 |
+
q2.render()
|
253 |
+
next_q2_btn.render()
|
254 |
+
next_q2_btn.click(
|
255 |
+
fn=next_q2,
|
256 |
+
inputs=[],
|
257 |
+
outputs=[question2, question3]
|
258 |
+
)
|
259 |
+
with gr.Column("Question 1", render=True, visible=True) as question1:
|
260 |
+
next_q1_btn = gr.Button("Next Question", render=False, visible=False, variant="primary")
|
261 |
+
q1 = generate_unassisted_question(question_prompts[0], next_q1_btn, 1, question_answers)
|
262 |
+
q1.render()
|
263 |
+
next_q1_btn.render()
|
264 |
+
next_q1_btn.click(
|
265 |
+
fn=next_q1,
|
266 |
+
inputs=[],
|
267 |
+
outputs=[question1, question2]
|
268 |
+
)
|
269 |
+
|
270 |
+
def start_assessment():
|
271 |
+
question_answers['q1']['StartTime'] = datetime.now().isoformat()
|
272 |
+
return {
|
273 |
+
welcome_pg: gr.update(visible=False),
|
274 |
+
assessment: gr.update(visible=True)
|
275 |
+
}
|
276 |
+
|
277 |
+
with gr.Column("Welcome to wrAIte", visible=True) as welcome_pg:
|
278 |
+
welcome_instr = process_markdown(False, 'instr_welcome.md')
|
279 |
+
welcome_text = gr.Markdown(value=welcome_instr, visible=True)
|
280 |
+
welcome_continue_btn = gr.Button("Continue", variant="primary", visible=True)
|
281 |
+
|
282 |
+
study_instr = process_markdown(False, 'instr_study.md')
|
283 |
+
study_text = gr.Markdown(value=study_instr, visible=False)
|
284 |
+
study_continue_btn = gr.Button("Begin Study", variant="primary", visible=False)
|
285 |
+
|
286 |
+
|
287 |
+
def show_study_instructions():
|
288 |
+
return {
|
289 |
+
welcome_text: gr.update(visible=False),
|
290 |
+
welcome_continue_btn: gr.update(visible=False),
|
291 |
+
study_text: gr.update(visible=True),
|
292 |
+
study_continue_btn: gr.update(visible=True),
|
293 |
+
}
|
294 |
+
|
295 |
+
|
296 |
+
welcome_continue_btn.click(
|
297 |
+
fn=show_study_instructions,
|
298 |
+
inputs=[],
|
299 |
+
outputs=[welcome_text, welcome_continue_btn, study_text, study_continue_btn]
|
300 |
+
)
|
301 |
+
|
302 |
+
study_continue_btn.click(
|
303 |
+
fn=start_assessment,
|
304 |
+
inputs=[],
|
305 |
+
outputs=[welcome_pg, assessment]
|
306 |
+
)
|
307 |
+
|
308 |
+
|
309 |
+
# if __name__ == "__main__":
|
310 |
+
# demo.launch()
|
311 |
+
demo.launch(share=True)
|
constants.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MAX_CONVERSATION_LENGTH = 20
|
2 |
+
MAX_TOKENS_PER_GENERATION = 512
|
3 |
+
SAMPLING_TEMPERATURE = 0.
|
4 |
+
|
5 |
+
plaintxt_instructions = [
|
6 |
+
["Welcome to our study!",
|
7 |
+
"In this task, you will be interacting with AI systems to explore how well AI systems can assist in various writing tasks.",
|
8 |
+
"Your responses will inform AI, writing, and potentially human-computer interaction research.",
|
9 |
+
"By participating in this study, you consent to having your responses stored and used for publication.",
|
10 |
+
"Your email and other identifying information (beyond level of mathematical expertise) will not be stored.",
|
11 |
+
"Please only continue if you are comfortable with the above."],
|
12 |
+
[
|
13 |
+
"In this study, you will be <strong>posed with writing tasks</strong> (e.g., theorems) and asked to <strong>evaluate how good different AI systems are at <i>helping to assist</i> in that writing task.</strong>",
|
14 |
+
"You may evaluate a maximum of four problems (two sets of two writing tasks over the two models). You will be given a writing task per writing challenge (e.g. creative short story writing, informative email writing).",
|
15 |
+
"Note: You will be assisted based on your initial responses to our preliminary questions."]
|
16 |
+
]
|
17 |
+
|
18 |
+
model_options = [
|
19 |
+
"chatgpt",
|
20 |
+
"instructgpt",
|
21 |
+
"chatgpt4"
|
22 |
+
]
|
23 |
+
|
data/.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
data/__init__.py
ADDED
File without changes
|
data/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (201 Bytes). View file
|
|
data/instructions/instr_assisted.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Please read the instructions below. Interact with the writing helper to explore how it may assist you in answering the following prompt. Write your response in the following text box.
|
data/instructions/instr_completed.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Thank you! You have successfully completed this survey.
|
data/instructions/instr_editresponse.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### To edit your response, please click the button below. You will no longer be able to edit the previous question once you proceed.
|
data/instructions/instr_email.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Instructions: Write an email for the following scenario in under 300 words.
|
data/instructions/instr_proceed.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Please click on the button below to proceed to the next question.
|
data/instructions/instr_questionnaire.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# Post-Assesment Questionnaire
|
2 |
+
## Please answer all of the questions below as objectively as you can.
|
data/instructions/instr_shortstory.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Instructions: Write a short story (300 words or less) which only uses very simple words.
|
data/instructions/instr_study.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## In this study, you will be posed with eight (8) writing prompts and asked to write a response to each of them.
|
2 |
+
## You will be given AI assistance for some prompts, and you will need to respond to others on your own.
|
3 |
+
## There will be a total of 4 writing categories (creative short story writing, informative email writing, title generation, and summarization). For each category you will be answering one assisted prompt and one unassisted prompt.
|
4 |
+
##
|
5 |
+
## After you finish answering the writing prompts, you will complete a questionnaire regarding your background information, writing skills, and experience interacting with LLMs (Large Language Models).
|
6 |
+
##
|
7 |
+
## Click the button below when you are ready to begin the study.
|
data/instructions/instr_submitsuccess.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## The following response has been successfully submitted:
|
data/instructions/instr_summary.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Instructions: Summarize the following article in 100 words or less.
|
data/instructions/instr_title.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Instructions: Write a creative title for the following article using 10 words or less.
|
data/instructions/instr_unassisted.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## Please read the instructions and writing prompt below. Write your response in the following text box.
|
data/instructions/instr_welcome.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Welcome to our study!
|
2 |
+
|
3 |
+
## In this task, you will be interacting with AI systems to explore how well AI systems can assist in answering writing prompts.
|
4 |
+
## Your responses will inform AI, writing, and potentially human-computer interaction research.
|
5 |
+
## By participating in this study, you consent to having your responses stored and used for publication.
|
6 |
+
## Your email and other identifying information (beyond level of writing expertise) will not be stored.
|
7 |
+
## Please only continue if you are comfortable with the above.
|
data/problems/p_email1.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You are organizing an outdoor team-building event aimed at improving team communication. Draft an email inviting colleagues, including details like date, time, and activities in your email.
|
data/problems/p_email10.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You wish to receive guidance from a more experienced person in your company. Write an email to someone at your company that you admire, explaining your current position, your career goals, and politely asking if they would be willing to mentor you.
|
data/problems/p_email2.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You recently ordered a coffee maker online, CoffeeCreate 3.0, which arrived defective. Compose an email to CoffeeCreate to complain about your purchase, asking for a replacement or refund and mentioning that it won't turn on despite troubleshooting.
|
data/problems/p_email3.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You are planning a surprise birthday party for a friend and need a venue. Write an email to a local community center named City LCC inquiring about the availability of rooms for the event, including details on capacity and pricing.
|
data/problems/p_email4.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### Your party decoration order purchase from Decor Co. was supposed to arrive last week but hasn't come yet. Compose an email to Decor Co. asking about the status of your order and expressing the urgency of receiving it.
|
data/problems/p_email5.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### After receiving career advice during a one-on-one session, write a thank-you email to your mentor, expressing your appreciation and discussing key takeaways, such as recommended training courses and networking strategies.
|
data/problems/p_email6.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You have been subscribed to a monthly gourmet snack delivery service, MonthlySnacks. While you enjoyed the deliveries, they don't fit your budget anymore. Write an email to the MonthlySnacks requesting the cancellation of your monthly subscription, including your financial reasons.
|
data/problems/p_email7.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You recently read a blog post on the impact of seasonal ingredients on cooking. You noticed that it did not include some key spices that could enhance the flavors further. Write an email to the food blog author providing constructive feedback, suggesting the inclusion of these spices and asking about their personal favorite seasonal recipes.
|
data/problems/p_email8.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You have noticed your colleague often schedules meetings and cancels at the last minute, which has been frustrating for you. Write an email to express your feelings clearly and respectfully.
|
data/problems/p_email9.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
### You are interested in attending an upcoming seminar on leadership and personal development that is highly relevant to your current role. Write an email to the seminar organizers asking for more details about the topics to be covered, the speakers, and the registration process.
|
data/problems/p_shortstory1.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## The story should use the verb "hang", the noun "foot" and the adjective "cute". The story should contain at least one dialogue.
|
data/problems/p_shortstory10.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## The story should use the verb "jog", the noun "purple" and the adjective "noisy". The story should contain at least one dialogue, have a bad ending, and have a moral value.
|
data/problems/p_shortstory2.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## In the story, try to at some point use the verb "hope", the noun "search" and the adjective "comfortable".
|
data/problems/p_shortstory3.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## In the story, try to at some point use the verb "pull", the noun "idea" and the adjective "sad". The story should also have a bad ending.
|
data/problems/p_shortstory4.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
## The story should use the verb "say", the noun "herb" and the adjective "shy".
|