Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,8 +26,8 @@ random_test_samples = dataset["test"].select(random.sample(range(0, len(dataset[
|
|
| 26 |
|
| 27 |
examples = []
|
| 28 |
for row in random_test_samples:
|
| 29 |
-
examples.append([row['support']
|
| 30 |
-
examples.append([row['support']
|
| 31 |
|
| 32 |
|
| 33 |
def predict(context, answer):
|
|
@@ -43,14 +43,14 @@ def predict(context, answer):
|
|
| 43 |
split_outputs = decoded_outputs.split("\n")
|
| 44 |
|
| 45 |
if len(split_outputs) == 6:
|
| 46 |
-
return
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
return None
|
| 56 |
|
|
@@ -88,14 +88,14 @@ distractor3_output_gr = gr.Text(
|
|
| 88 |
label="Output"
|
| 89 |
)
|
| 90 |
|
| 91 |
-
button.click(
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
|
| 100 |
gr.Interface(
|
| 101 |
fn=predict,
|
|
|
|
| 26 |
|
| 27 |
examples = []
|
| 28 |
for row in random_test_samples:
|
| 29 |
+
examples.append([row['support'], None])
|
| 30 |
+
examples.append([row['support'], row['correct_answer']])
|
| 31 |
|
| 32 |
|
| 33 |
def predict(context, answer):
|
|
|
|
| 43 |
split_outputs = decoded_outputs.split("\n")
|
| 44 |
|
| 45 |
if len(split_outputs) == 6:
|
| 46 |
+
return (
|
| 47 |
+
split_outputs[0],
|
| 48 |
+
split_outputs[1],
|
| 49 |
+
split_outputs[2],
|
| 50 |
+
split_outputs[3],
|
| 51 |
+
split_outputs[4],
|
| 52 |
+
split_outputs[5],
|
| 53 |
+
)
|
| 54 |
|
| 55 |
return None
|
| 56 |
|
|
|
|
| 88 |
label="Output"
|
| 89 |
)
|
| 90 |
|
| 91 |
+
# button.click(
|
| 92 |
+
# predict,
|
| 93 |
+
# [
|
| 94 |
+
# support_gr,
|
| 95 |
+
# answer_gr,
|
| 96 |
+
# ],
|
| 97 |
+
# outputs=[context_output_gr, answer_output_gr, question_output_gr, distractor1_output_gr, distractor2_output_gr, distractor3_output_gr],
|
| 98 |
+
# )
|
| 99 |
|
| 100 |
gr.Interface(
|
| 101 |
fn=predict,
|