Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -49,6 +49,14 @@ def updateScore(radio):
|
|
| 49 |
else:
|
| 50 |
score -= 1
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
## gradio
|
| 54 |
# submit button function. updates everything.
|
|
@@ -60,10 +68,12 @@ def onSubmit(image, radio, scorebox):
|
|
| 60 |
updateScore(radio)
|
| 61 |
setRandAnswer()
|
| 62 |
setMinPairGroup()
|
|
|
|
| 63 |
|
| 64 |
image = gr.Image(f'./assets/{answer}.jpeg', label=answer, show_label= False)
|
| 65 |
radio = gr.Radio(choices=minPairGroup, label='Which word is pictured?', value=None)
|
| 66 |
scorebox = gr.Markdown(f"# Score: {score}")
|
|
|
|
| 67 |
|
| 68 |
return image, radio, scorebox
|
| 69 |
|
|
|
|
| 49 |
else:
|
| 50 |
score -= 1
|
| 51 |
|
| 52 |
+
def dialogueBox(radio):
|
| 53 |
+
global text
|
| 54 |
+
if radio == answer:
|
| 55 |
+
text = gr.Textbox("Correct.")
|
| 56 |
+
else:
|
| 57 |
+
text = gr.Textbox("Incorrect.")
|
| 58 |
+
|
| 59 |
+
|
| 60 |
|
| 61 |
## gradio
|
| 62 |
# submit button function. updates everything.
|
|
|
|
| 68 |
updateScore(radio)
|
| 69 |
setRandAnswer()
|
| 70 |
setMinPairGroup()
|
| 71 |
+
dialogueBox(radio)
|
| 72 |
|
| 73 |
image = gr.Image(f'./assets/{answer}.jpeg', label=answer, show_label= False)
|
| 74 |
radio = gr.Radio(choices=minPairGroup, label='Which word is pictured?', value=None)
|
| 75 |
scorebox = gr.Markdown(f"# Score: {score}")
|
| 76 |
+
|
| 77 |
|
| 78 |
return image, radio, scorebox
|
| 79 |
|