Spaces:
Runtime error
Runtime error
VictorSanh
commited on
Commit
Β·
1154e3f
1
Parent(s):
0ea8e96
error handling
Browse files
app.py
CHANGED
@@ -127,7 +127,7 @@ def model_inference(
|
|
127 |
image,
|
128 |
):
|
129 |
if image is None:
|
130 |
-
raise
|
131 |
|
132 |
# return "A"
|
133 |
inputs = PROCESSOR.tokenizer(
|
@@ -229,7 +229,7 @@ with gr.Blocks(title="Beat the AI", theme=gr.themes.Base(), css=css) as demo:
|
|
229 |
|
230 |
def result_string(model_pred, user_pred, solution):
|
231 |
if solution == "":
|
232 |
-
return "
|
233 |
|
234 |
solution_letter = chr(ord('A') + int(solution))
|
235 |
solution_string = f"The correct answer is {solution_letter}."
|
|
|
127 |
image,
|
128 |
):
|
129 |
if image is None:
|
130 |
+
raise gr.Error("Load a new sample first!")
|
131 |
|
132 |
# return "A"
|
133 |
inputs = PROCESSOR.tokenizer(
|
|
|
229 |
|
230 |
def result_string(model_pred, user_pred, solution):
|
231 |
if solution == "":
|
232 |
+
return ""
|
233 |
|
234 |
solution_letter = chr(ord('A') + int(solution))
|
235 |
solution_string = f"The correct answer is {solution_letter}."
|