add error
Browse files
app.py
CHANGED
@@ -6,6 +6,19 @@ import os
|
|
6 |
# Create your own Gradio interface instead of using the built-in widget
|
7 |
def create_interface(module):
|
8 |
def evaluate_fn(prediction, references, pos_pred, neg_pred):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Process a single prediction instead of multiple
|
10 |
pred = prediction.strip()
|
11 |
|
|
|
6 |
# Create your own Gradio interface instead of using the built-in widget
|
7 |
def create_interface(module):
|
8 |
def evaluate_fn(prediction, references, pos_pred, neg_pred):
|
9 |
+
# Check if all required fields are filled
|
10 |
+
if not prediction or prediction.strip() == "":
|
11 |
+
return "", "", "", "Please provide a candidate hypothesis to evaluate."
|
12 |
+
|
13 |
+
if not references or references.strip() == "":
|
14 |
+
return "", "", "", "Please provide a validation program."
|
15 |
+
|
16 |
+
if not pos_pred or pos_pred.strip() == "":
|
17 |
+
return "", "", "", "Please specify the positive predicate name."
|
18 |
+
|
19 |
+
if not neg_pred or neg_pred.strip() == "":
|
20 |
+
return "", "", "", "Please specify the negative predicate name."
|
21 |
+
|
22 |
# Process a single prediction instead of multiple
|
23 |
pred = prediction.strip()
|
24 |
|