Commit ·
5c2c850
1
Parent(s): 6d57088
- __pycache__/func.cpython-39.pyc +0 -0
- app.py +28 -3
- func.py +9 -0
__pycache__/func.cpython-39.pyc
ADDED
|
Binary file (596 Bytes). View file
|
|
|
app.py
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import uuid
|
| 4 |
-
|
| 5 |
WEBHOOK_URL = "https://script.google.com/macros/s/AKfycby_67Zh_ELOMcD9mLxf-nZYi_nNdsGb_C7E66uYdK924JKx2eps6nn8TizLYdtzqQvCAw/exec"
|
| 6 |
|
| 7 |
def submit_all(q1_choice, q1_feedback, q2_choice, q2_feedback, q3_choice, q3_feedback):
|
| 8 |
# Check if any required choice is missing
|
| 9 |
if not all([q1_choice, q2_choice, q3_choice]):
|
| 10 |
return f"""# ⚠️ Submission Failed
|
|
|
|
| 11 |
### Please answer all three multiple-choice questions before submitting.
|
| 12 |
"""
|
| 13 |
|
|
@@ -97,6 +98,13 @@ with gr.Blocks() as demo:
|
|
| 97 |
min-width: 220px;
|
| 98 |
flex: 1;
|
| 99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
</style>''')
|
| 101 |
with gr.Tabs():
|
| 102 |
with gr.Tab(" Question 1"):
|
|
@@ -172,10 +180,27 @@ with gr.Blocks() as demo:
|
|
| 172 |
show_label=False,
|
| 173 |
container=False,
|
| 174 |
elem_id="top3_box")
|
| 175 |
-
|
|
|
|
| 176 |
# gr.Image("assets/ex2.png")
|
|
|
|
|
|
|
| 177 |
gr.Markdown("## Q1. Which explanation was easier to understand?")
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
q1_feedback = gr.Textbox(placeholder="e.g., Explanation A was clearer")
|
| 180 |
|
| 181 |
with gr.Tab(" Question 2"):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import uuid
|
| 4 |
+
import func
|
| 5 |
WEBHOOK_URL = "https://script.google.com/macros/s/AKfycby_67Zh_ELOMcD9mLxf-nZYi_nNdsGb_C7E66uYdK924JKx2eps6nn8TizLYdtzqQvCAw/exec"
|
| 6 |
|
| 7 |
def submit_all(q1_choice, q1_feedback, q2_choice, q2_feedback, q3_choice, q3_feedback):
|
| 8 |
# Check if any required choice is missing
|
| 9 |
if not all([q1_choice, q2_choice, q3_choice]):
|
| 10 |
return f"""# ⚠️ Submission Failed
|
| 11 |
+
|
| 12 |
### Please answer all three multiple-choice questions before submitting.
|
| 13 |
"""
|
| 14 |
|
|
|
|
| 98 |
min-width: 220px;
|
| 99 |
flex: 1;
|
| 100 |
}
|
| 101 |
+
.q1-radio-large .gr-radio label {
|
| 102 |
+
font-size: 20px;
|
| 103 |
+
line-height: 1.8;
|
| 104 |
+
margin-bottom: 6px;
|
| 105 |
+
padding: 10px;
|
| 106 |
+
display: block;
|
| 107 |
+
}
|
| 108 |
</style>''')
|
| 109 |
with gr.Tabs():
|
| 110 |
with gr.Tab(" Question 1"):
|
|
|
|
| 180 |
show_label=False,
|
| 181 |
container=False,
|
| 182 |
elem_id="top3_box")
|
| 183 |
+
gr.Markdown("<hr>")
|
| 184 |
+
gr.Markdown("<br>")
|
| 185 |
# gr.Image("assets/ex2.png")
|
| 186 |
+
# gr.Markdown("# Q1. Which explanation was easier to understand?")
|
| 187 |
+
# q1_choice = gr.Radio(["Explanation A", "Explanation B"])
|
| 188 |
gr.Markdown("## Q1. Which explanation was easier to understand?")
|
| 189 |
+
|
| 190 |
+
q1_choice = gr.Radio(
|
| 191 |
+
[
|
| 192 |
+
"A was *much easier* to understand",
|
| 193 |
+
"A was *somewhat easier* to understand",
|
| 194 |
+
"Both were *about the same*",
|
| 195 |
+
"B was *somewhat easier* to understand",
|
| 196 |
+
"B was *much easier* to understand",
|
| 197 |
+
],
|
| 198 |
+
label="",
|
| 199 |
+
info="Consider which explanation helped you understand the model's decision better.",
|
| 200 |
+
show_label=False,
|
| 201 |
+
elem_classes=["q1-radio-large"]
|
| 202 |
+
)
|
| 203 |
+
# q1_choice= func.convert_q1_choice(q1_choice)
|
| 204 |
q1_feedback = gr.Textbox(placeholder="e.g., Explanation A was clearer")
|
| 205 |
|
| 206 |
with gr.Tab(" Question 2"):
|
func.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def convert_q1_choice(choice):
|
| 2 |
+
mapping = {
|
| 3 |
+
"1. Explanation A was *much easier* to understand": 1,
|
| 4 |
+
"2. Explanation A was *somewhat easier* to understand": 2,
|
| 5 |
+
"3. Both explanations were *about the same*": 3,
|
| 6 |
+
"4. Explanation B was *somewhat easier* to understand": 4,
|
| 7 |
+
"5. Explanation B was *much easier* to understand": 5,
|
| 8 |
+
}
|
| 9 |
+
return str(mapping.get(choice, -1))
|