Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -194,16 +194,18 @@ with gr.Blocks(title="Beat the AI", theme=gr.themes.Base(), css=css) as demo:
|
|
| 194 |
# Will you beat the AI at these RAVEN puzzles?
|
| 195 |
|
| 196 |
*This demo features an early fine-tuned version of our forth-coming Idefics2 model. The model was fine-tuned on the [RAVEN](https://huggingface.co/datasets/HuggingFaceM4/RAVEN) dataset and reached 91% accuracy on the validation set.*
|
|
|
|
|
|
|
| 197 |
"""
|
| 198 |
)
|
| 199 |
-
load_new_sample = gr.Button(value="Load new
|
| 200 |
with gr.Row(equal_height=True):
|
| 201 |
with gr.Column(scale=4, min_width=250) as upload_area:
|
| 202 |
imagebox = gr.Image(
|
| 203 |
image_mode="L",
|
| 204 |
type="pil",
|
| 205 |
visible=True,
|
| 206 |
-
sources=
|
| 207 |
)
|
| 208 |
with gr.Column(scale=4):
|
| 209 |
with gr.Row():
|
|
@@ -231,7 +233,7 @@ with gr.Blocks(title="Beat the AI", theme=gr.themes.Base(), css=css) as demo:
|
|
| 231 |
|
| 232 |
def result_string(model_pred, user_pred, solution):
|
| 233 |
solution_letter = chr(ord('A') + int(solution))
|
| 234 |
-
solution_string = f"The correct answer is
|
| 235 |
|
| 236 |
win_or_loose = "π₯" if user_pred == solution_letter else "π"
|
| 237 |
|
|
@@ -241,6 +243,8 @@ with gr.Blocks(title="Beat the AI", theme=gr.themes.Base(), css=css) as demo:
|
|
| 241 |
comparison_string = "You beat the AI!"
|
| 242 |
elif user_pred != solution_letter and model_pred != solution_letter:
|
| 243 |
comparison_string = "Both you and the AI got it wrong!"
|
|
|
|
|
|
|
| 244 |
|
| 245 |
return f"{win_or_loose} {comparison_string}\n{solution_string}"
|
| 246 |
|
|
|
|
| 194 |
# Will you beat the AI at these RAVEN puzzles?
|
| 195 |
|
| 196 |
*This demo features an early fine-tuned version of our forth-coming Idefics2 model. The model was fine-tuned on the [RAVEN](https://huggingface.co/datasets/HuggingFaceM4/RAVEN) dataset and reached 91% accuracy on the validation set.*
|
| 197 |
+
|
| 198 |
+
To get started, load a new puzzle.
|
| 199 |
"""
|
| 200 |
)
|
| 201 |
+
load_new_sample = gr.Button(value="Load a new puzzle")
|
| 202 |
with gr.Row(equal_height=True):
|
| 203 |
with gr.Column(scale=4, min_width=250) as upload_area:
|
| 204 |
imagebox = gr.Image(
|
| 205 |
image_mode="L",
|
| 206 |
type="pil",
|
| 207 |
visible=True,
|
| 208 |
+
sources=[],
|
| 209 |
)
|
| 210 |
with gr.Column(scale=4):
|
| 211 |
with gr.Row():
|
|
|
|
| 233 |
|
| 234 |
def result_string(model_pred, user_pred, solution):
|
| 235 |
solution_letter = chr(ord('A') + int(solution))
|
| 236 |
+
solution_string = f"The correct answer is {solution_letter}."
|
| 237 |
|
| 238 |
win_or_loose = "π₯" if user_pred == solution_letter else "π"
|
| 239 |
|
|
|
|
| 243 |
comparison_string = "You beat the AI!"
|
| 244 |
elif user_pred != solution_letter and model_pred != solution_letter:
|
| 245 |
comparison_string = "Both you and the AI got it wrong!"
|
| 246 |
+
else:
|
| 247 |
+
raise ValueError(model_pred, user_pred, solution)
|
| 248 |
|
| 249 |
return f"{win_or_loose} {comparison_string}\n{solution_string}"
|
| 250 |
|