dropdown selection logger
Browse files- app/ui/common.py +7 -0
- app/ui/prompts_tab.py +1 -1
- app/ui/test_set_tab.py +2 -2
- main.py +5 -0
app/ui/common.py
CHANGED
|
@@ -31,3 +31,10 @@ def update_response_textboxes_amount(sampling_count: str):
|
|
| 31 |
# Hide the rest
|
| 32 |
updates.append(gr.update(visible=False, label=f"Response {i + 1}"))
|
| 33 |
return updates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Hide the rest
|
| 32 |
updates.append(gr.update(visible=False, label=f"Response {i + 1}"))
|
| 33 |
return updates
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def log_dropdown_choice(choice):
|
| 37 |
+
print(f"A dropdown menu changed to: {choice}")
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
app/ui/prompts_tab.py
CHANGED
|
@@ -17,7 +17,7 @@ def build_prompts_tab():
|
|
| 17 |
pipeline_choice = gr.Dropdown(
|
| 18 |
choices=["Exercise Diagnosis 🩺", "Distractors Brainstorm 🤔", "Learning Objectives Identification 🧠", "ALL OF THEM ✨", ],
|
| 19 |
value="Exercise Diagnosis 🩺",
|
| 20 |
-
label="Tasks Pipelines"
|
| 21 |
)
|
| 22 |
with gr.Column(scale=2):
|
| 23 |
pass # only here to keep the first column in check: force narrower dropdown
|
|
|
|
| 17 |
pipeline_choice = gr.Dropdown(
|
| 18 |
choices=["Exercise Diagnosis 🩺", "Distractors Brainstorm 🤔", "Learning Objectives Identification 🧠", "ALL OF THEM ✨", ],
|
| 19 |
value="Exercise Diagnosis 🩺",
|
| 20 |
+
label="Tasks Pipelines 🚧"
|
| 21 |
)
|
| 22 |
with gr.Column(scale=2):
|
| 23 |
pass # only here to keep the first column in check: force narrower dropdown
|
app/ui/test_set_tab.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def build_test_set_tab():
|
| 4 |
-
with gr.TabItem("
|
| 5 |
gr.HTML(
|
| 6 |
"""
|
| 7 |
<div style="margin-bottom: 10px;">
|
|
@@ -16,7 +16,7 @@ def build_test_set_tab():
|
|
| 16 |
with gr.Column(scale=1):
|
| 17 |
subset_choice = gr.Dropdown(
|
| 18 |
choices=["Exercises ❔🚧", "Study Texts ️ℹ️🚧", "Show all ❔ℹ️"],
|
| 19 |
-
value="
|
| 20 |
label="Subset Filter 🚧"
|
| 21 |
)
|
| 22 |
with gr.Column(scale=2):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def build_test_set_tab():
|
| 4 |
+
with gr.TabItem("🚧 Test Set"):
|
| 5 |
gr.HTML(
|
| 6 |
"""
|
| 7 |
<div style="margin-bottom: 10px;">
|
|
|
|
| 16 |
with gr.Column(scale=1):
|
| 17 |
subset_choice = gr.Dropdown(
|
| 18 |
choices=["Exercises ❔🚧", "Study Texts ️ℹ️🚧", "Show all ❔ℹ️"],
|
| 19 |
+
value="Show all ❔ℹ️",
|
| 20 |
label="Subset Filter 🚧"
|
| 21 |
)
|
| 22 |
with gr.Column(scale=2):
|
main.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
# main.py
|
| 2 |
import gradio as gr
|
| 3 |
import logging
|
|
|
|
|
|
|
| 4 |
from app.ui.diagnoser_tab import build_diagnoser_tab
|
| 5 |
from app.ui.distractors_tab import build_distractors_tab
|
| 6 |
from app.ui.learning_objectives_tab import build_learning_objectives_tab
|
|
@@ -139,5 +141,8 @@ with gr.Blocks() as interface:
|
|
| 139 |
# or "stream=True" depending on your version of Gradio
|
| 140 |
)
|
| 141 |
|
|
|
|
|
|
|
|
|
|
| 142 |
# Launch the app.
|
| 143 |
interface.launch()
|
|
|
|
| 1 |
# main.py
|
| 2 |
import gradio as gr
|
| 3 |
import logging
|
| 4 |
+
|
| 5 |
+
from app.ui.common import log_dropdown_choice
|
| 6 |
from app.ui.diagnoser_tab import build_diagnoser_tab
|
| 7 |
from app.ui.distractors_tab import build_distractors_tab
|
| 8 |
from app.ui.learning_objectives_tab import build_learning_objectives_tab
|
|
|
|
| 141 |
# or "stream=True" depending on your version of Gradio
|
| 142 |
)
|
| 143 |
|
| 144 |
+
pipeline_choice.change(fn=log_dropdown_choice, inputs=pipeline_choice, outputs=[])
|
| 145 |
+
subset_choice.change(fn=log_dropdown_choice, inputs=subset_choice, outputs=[])
|
| 146 |
+
|
| 147 |
# Launch the app.
|
| 148 |
interface.launch()
|