elibrowne commited on
Commit
7b358db
1 Parent(s): c40bc82
Files changed (1) hide show
  1. app.py +30 -17
app.py CHANGED
@@ -30,10 +30,11 @@ def save_json(score1, score2):
30
 
31
  # READING EXISTING DATA: this is used to read questionss
32
 
 
33
  from datasets import load_dataset
34
  qa_data = load_dataset("ebrowne/test-data", data_files = "test.json")
35
  q = qa_data["train"][0] # loaded question data
36
-
37
 
38
  # VARIABLES: will eventually be loaded with JSON from a dataset
39
 
@@ -44,6 +45,16 @@ answers_text = [q["a"], q["b"], q["c"], q["d"]]
44
  question_text = "An act of Congress provides that \"no federal court shall order the implementation of a public school desegregation plan that would require the transportation of any student to a school other than the school closest or next closest to his place of residence.\" Which of the following is the strongest argument for the constitutionality of the act?"
45
  answers_text = ["The Fourteenth Amendment authorizes Congress to define governmental conduct which violates the equal protection clause.", "Under Article III, Congress may restrict the jurisdiction of the federal courts.", "Transportation of students is subject to regulation by Congress because commerce is involved.", "Congress provides partial support for public education and is therefore entitled to establish conditions upon the expenditure of federal grants."]
46
  answer_id = 1
 
 
 
 
 
 
 
 
 
 
47
 
48
  # BLOCKS: main user interface
49
 
@@ -51,7 +62,7 @@ with gr.Blocks() as user_eval:
51
  # Title text introducing study
52
  gr.Markdown("""
53
  # Legal Retriever Evaluation Study
54
- Thank you for your participation! Here are some basic instructions on how to complete the legal study.
55
  """)
56
 
57
  # Passages and user evaluations thereof
@@ -69,19 +80,10 @@ with gr.Blocks() as user_eval:
69
  """ \n
70
  """ + answers_text[2] +
71
  """ \n
72
- """ + answers_text[3] +
73
- """
74
- ### Relevant Passages
75
- - Dataset 1
76
- - Dataset 2
77
- - More text
78
- - More text
79
- - More text
80
- - More text
81
- ### Auto-Generated Summary
82
- This is a summary of the above legal passages, which imitates how a RAG system might \
83
- encorporate retrieved data into its context to give a better response to a certain query.
84
- """)
85
 
86
  # Scoring box
87
  with gr.Column(scale = 1) as scores:
@@ -94,9 +96,20 @@ with gr.Blocks() as user_eval:
94
  btn = gr.Button("Next")
95
 
96
  def next(eval_1, eval_2, eval_3):
 
97
  print(eval_1 + eval_2 + eval_3)
98
-
99
- btn.click(fn = next, inputs = [eval_1, eval_2, eval_3])
 
 
 
 
 
 
 
 
 
 
100
 
101
  # Question and answering dynamics
102
  with gr.Row() as question:
 
30
 
31
  # READING EXISTING DATA: this is used to read questionss
32
 
33
+ """
34
  from datasets import load_dataset
35
  qa_data = load_dataset("ebrowne/test-data", data_files = "test.json")
36
  q = qa_data["train"][0] # loaded question data
37
+ """
38
 
39
  # VARIABLES: will eventually be loaded with JSON from a dataset
40
 
 
45
  question_text = "An act of Congress provides that \"no federal court shall order the implementation of a public school desegregation plan that would require the transportation of any student to a school other than the school closest or next closest to his place of residence.\" Which of the following is the strongest argument for the constitutionality of the act?"
46
  answers_text = ["The Fourteenth Amendment authorizes Congress to define governmental conduct which violates the equal protection clause.", "Under Article III, Congress may restrict the jurisdiction of the federal courts.", "Transportation of students is subject to regulation by Congress because commerce is involved.", "Congress provides partial support for public education and is therefore entitled to establish conditions upon the expenditure of federal grants."]
47
  answer_id = 1
48
+ passages = ["The IDEA also requires states receiving federal funds to educate disabled children in the \"[l]east restrictive environment\" appropriate for each child. 20 U.S.C. § 1412(a)(5). The statute mandates at § 1412(a)(5)(A):",
49
+ "Under the current iteration of Arkansas' school choice law-the 2017 Act-a school that claims a conflict with participating in school choice must show that it is subject to an active and enforceable desegregation court order or plan that \"explicitly limits the transfer of students between school districts.\" Ark. Code Ann. § 6-18-1906(a)(2). Accordingly, for Junction City to receive an exemption from participating in school choice under the 2017 Act, it must show that it is subject to a desegregation order that explicitly bars \"inter-district\" student transfers.",
50
+ "This is not to say that a school may unilaterally reject or revise a child's stay-put IEP-that would defang the stay-put requirement entirely. To the contrary, the Supreme Court has made clear that the IDEA \"strip[s] schools of the unilateral authority they had traditionally employed to exclude disabled students.\" Honig , 484 U.S. at 323, 108 S.Ct. 592 (emphasis omitted); see also Sch. Comm. of the Town of Burlington v. Dep't of Educ. , 471 U.S. 359, 373, 105 S.Ct. 1996, 85 L.Ed.2d 385 (1985). Courts should therefore view deviations from the IEP \"with a critical eye to ensure that motivations other than those compatible with the statute, such as bureaucratic inertia, are not driving the decision.\" John M. , 502 F.3d at 715. But context matters; for example, as a child moves \"from elementary school to middle school or from middle school to high school,\" not every change necessitated by a new educational environment will necessarily violate the IDEA. See id. at 714-15.",
51
+ "Under § 79-209(2), all schools are required to have a policy that states the number of absences after which the school shall render services to address a student's barriers to attendance. Such services shall include, but not be limited to:",
52
+ "To assure that children attending public schools obtain a high quality education, the legislature shall make adequate provision to ensure that ... there are a sufficient number of classrooms ....",
53
+ "courts should not disturb a state's denial of IDEA reimbursement where the chief benefits of the chosen school are the kind of advantages that might be preferred by parents of any child, disabled or not. Rather, the unilateral private placement is only appropriate if it provides education instruction [specially ] designed to meet the unique needs of a handicapped child.",
54
+ "It is also likely that residents of the States will attend out-of-state schools that invoke the Exemptions, and that such students will seek contraceptive services through programs in their home states, also giving rise to fiscal injuries to the States that only a nationwide injunction can remedy.",
55
+ "Although state classifications based on alienage are generally suspect, a state may reserve a government position for citizens if it is related to self-governance, involves policymaking, or requires exercise of important discretionary power over citizens. In these cases, only a rationality test is used. A public school teacher at the primary and secondary school level performs an important governmental function (e.g., he influences students' attitudes about government, the political process, citizenship, etc.), and therefore the exclusion of aliens is rationally related to the state's interest in furthering educational goals. [Ambach v. Norwick (1979)]"
56
+ ]
57
+ step = 0
58
 
59
  # BLOCKS: main user interface
60
 
 
62
  # Title text introducing study
63
  gr.Markdown("""
64
  # Legal Retriever Evaluation Study
65
+ Score the passages based on the question and provided answer choices.
66
  """)
67
 
68
  # Passages and user evaluations thereof
 
80
  """ \n
81
  """ + answers_text[2] +
82
  """ \n
83
+ """ + answers_text[3])
84
+ selection = gr.Markdown("""
85
+ ### Retrieved Passage
86
+ """ + passages[0])
 
 
 
 
 
 
 
 
 
87
 
88
  # Scoring box
89
  with gr.Column(scale = 1) as scores:
 
96
  btn = gr.Button("Next")
97
 
98
  def next(eval_1, eval_2, eval_3):
99
+ step += 1
100
  print(eval_1 + eval_2 + eval_3)
101
+ if step == len(passages):
102
+ return {
103
+ selection: gr.Markdown("Done!")
104
+ }
105
+ else:
106
+ return {
107
+ selection: gr.Markdown("""
108
+ ### Retrieved Passage
109
+ """ + passages[step])
110
+ }
111
+
112
+ btn.click(fn = next, inputs = [eval_1, eval_2, eval_3], outputs = [selection])
113
 
114
  # Question and answering dynamics
115
  with gr.Row() as question: