Spaces:
Sleeping
Sleeping
Commit
·
7c576e7
1
Parent(s):
ccb4963
updated to prevent the failures and give bad questions
Browse files- app.py +22 -7
- outputs/professor_guide.csv +1 -3
app.py
CHANGED
@@ -19,7 +19,7 @@ def run_with_context(func: Callable) -> Callable:
|
|
19 |
|
20 |
def generate_questions(
|
21 |
page_lower, page_higher, question_number, taxonomy
|
22 |
-
) -> tuple[str,
|
23 |
if machine.value and machine.value.current_state_value == "start":
|
24 |
machine.value.start_machine() # Start the machine!
|
25 |
if not question_number or question_number <= 0:
|
@@ -60,17 +60,26 @@ def generate_questions(
|
|
60 |
},
|
61 |
},
|
62 |
)
|
63 |
-
button = gr.
|
|
|
64 |
visible=True,
|
|
|
65 |
value=f"{Path.cwd().joinpath('outputs/professor_guide.csv')}",
|
66 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
markdown = "## Questions Ready for Download Below"
|
68 |
if machine.value.errored:
|
69 |
-
button = gr.update()
|
|
|
70 |
markdown = "## Questions Not Ready for Download"
|
71 |
exception = "Bad Page Range Selected"
|
72 |
raise gr.Error(exception)
|
73 |
-
return (markdown, button)
|
74 |
|
75 |
|
76 |
def create_statemachine() -> None:
|
@@ -84,7 +93,7 @@ def create_statemachine() -> None:
|
|
84 |
|
85 |
|
86 |
def questions_downloaded() -> dict[str, Any]:
|
87 |
-
return gr.update(
|
88 |
|
89 |
|
90 |
with gr.Blocks() as demo:
|
@@ -115,14 +124,20 @@ with gr.Blocks() as demo:
|
|
115 |
download_professor = gr.DownloadButton(
|
116 |
label="Download Questions", visible=False, scale=1
|
117 |
)
|
|
|
|
|
|
|
118 |
create_statemachine()
|
119 |
start_button.click(
|
120 |
fn=run_with_context(generate_questions),
|
121 |
inputs=[page_lower, page_higher, question_number, taxonomy],
|
122 |
-
outputs=[output, download_professor],
|
123 |
)
|
124 |
download_professor.click(
|
125 |
-
fn=run_with_context(questions_downloaded), outputs=[
|
|
|
|
|
|
|
126 |
)
|
127 |
|
128 |
load_dotenv()
|
|
|
19 |
|
20 |
def generate_questions(
|
21 |
page_lower, page_higher, question_number, taxonomy
|
22 |
+
) -> tuple[str, gr.DownloadButton, gr.DownloadButton]:
|
23 |
if machine.value and machine.value.current_state_value == "start":
|
24 |
machine.value.start_machine() # Start the machine!
|
25 |
if not question_number or question_number <= 0:
|
|
|
60 |
},
|
61 |
},
|
62 |
)
|
63 |
+
button = gr.DownloadButton(
|
64 |
+
label="Download Questions",
|
65 |
visible=True,
|
66 |
+
scale=1,
|
67 |
value=f"{Path.cwd().joinpath('outputs/professor_guide.csv')}",
|
68 |
)
|
69 |
+
button_2 = gr.DownloadButton(
|
70 |
+
visible=True,
|
71 |
+
value=f"{Path.cwd().joinpath('outputs/rejected_list.csv')}",
|
72 |
+
scale=1,
|
73 |
+
label="Download Failed Questions",
|
74 |
+
)
|
75 |
markdown = "## Questions Ready for Download Below"
|
76 |
if machine.value.errored:
|
77 |
+
button = gr.update(visible=False)
|
78 |
+
button_2 = gr.update(visible=False)
|
79 |
markdown = "## Questions Not Ready for Download"
|
80 |
exception = "Bad Page Range Selected"
|
81 |
raise gr.Error(exception)
|
82 |
+
return (markdown, button, button_2)
|
83 |
|
84 |
|
85 |
def create_statemachine() -> None:
|
|
|
93 |
|
94 |
|
95 |
def questions_downloaded() -> dict[str, Any]:
|
96 |
+
return gr.update(visible=False)
|
97 |
|
98 |
|
99 |
with gr.Blocks() as demo:
|
|
|
124 |
download_professor = gr.DownloadButton(
|
125 |
label="Download Questions", visible=False, scale=1
|
126 |
)
|
127 |
+
download_failures = gr.DownloadButton(
|
128 |
+
label="Download Failed Questions", visible=False, scale=1
|
129 |
+
)
|
130 |
create_statemachine()
|
131 |
start_button.click(
|
132 |
fn=run_with_context(generate_questions),
|
133 |
inputs=[page_lower, page_higher, question_number, taxonomy],
|
134 |
+
outputs=[output, download_professor, download_failures],
|
135 |
)
|
136 |
download_professor.click(
|
137 |
+
fn=run_with_context(questions_downloaded), outputs=[download_professor]
|
138 |
+
)
|
139 |
+
download_failures.click(
|
140 |
+
fn=run_with_context(questions_downloaded), outputs=[download_failures]
|
141 |
)
|
142 |
|
143 |
load_dotenv()
|
outputs/professor_guide.csv
CHANGED
@@ -1,3 +1 @@
|
|
1 |
-
MC,,1,Identify the
|
2 |
-
MC,,1,Identify the percentage of working time the Core Team spends on ceremonies.,3,The Core Team spends 10% of working time on ceremonies.,The Core Team spends 7% of working time on ceremonies.,The Core Team spends 9% of working time on ceremonies.,The Core Team spends 11% of working time on ceremonies.,The Core Team spends 8% of working time on ceremonies.,68-81,Knowledge
|
3 |
-
MC,,1,Identify the frequency of the Biweekly Retrospective meetings as mentioned in the textbook.,5,Biweekly Retrospective meetings occur twice a month.,Biweekly Retrospective meetings occur every four weeks.,Biweekly Retrospective meetings occur once a month.,Biweekly Retrospective meetings occur every three weeks.,Biweekly Retrospective meetings occur every two weeks.,68-81,Knowledge
|
|
|
1 |
+
MC,,1,Identify the rule of thumb for reducing uncertainty before building anything.,1,Reduce uncertainty as much as you can before you build anything.,Minimize risks extensively before starting any building project.,Ensure clarity as much as possible before any construction.,Gather evidence thoroughly before beginning any building process.,Increase certainty as much as possible before starting construction.,94-95,Knowledge
|
|
|
|