Update app.py
Browse files
app.py
CHANGED
|
@@ -126,7 +126,7 @@ def toggle_hint_mode():
|
|
| 126 |
gr.update(visible=True)
|
| 127 |
)
|
| 128 |
with gr.Blocks(title="Kasoti", theme=gr.themes.Soft(primary_hue="pink", secondary_hue="blue")) as demo:
|
| 129 |
-
#
|
| 130 |
gr.Markdown(
|
| 131 |
"""
|
| 132 |
<link href="https://fonts.googleapis.com/css2?family=Comic+Neue&display=swap" rel="stylesheet">
|
|
@@ -156,7 +156,7 @@ with gr.Blocks(title="Kasoti", theme=gr.themes.Soft(primary_hue="pink", secondar
|
|
| 156 |
</style>
|
| 157 |
<div class='title-text'>π§ Kasoti - The Mind Reading Game</div>
|
| 158 |
<p class='subtitle-text'>Think of something and answer my yes/no questions β let's see if I can guess it in 20 tries! π΅οΈββοΈ</p>
|
| 159 |
-
"""
|
| 160 |
)
|
| 161 |
|
| 162 |
with gr.Row():
|
|
@@ -180,11 +180,20 @@ with gr.Blocks(title="Kasoti", theme=gr.themes.Soft(primary_hue="pink", secondar
|
|
| 180 |
game_history = gr.Textbox(label="π Game Updates", interactive=False, lines=3)
|
| 181 |
final_answer_box = gr.Textbox(label="π― Final Guess", visible=False, lines=2, interactive=False)
|
| 182 |
|
| 183 |
-
# Button
|
| 184 |
-
start.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
hint_toggle.click(fn=toggle_hint_mode, outputs=[hint_status, game_history])
|
| 186 |
hint_toggle.click(fn=hint_response, outputs=[game_history])
|
| 187 |
transcribe.click(fn=convert_audio_to_text, inputs=[mic_input, lang_sel], outputs=[typed_ans])
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
demo.launch()
|
|
|
|
| 126 |
gr.update(visible=True)
|
| 127 |
)
|
| 128 |
with gr.Blocks(title="Kasoti", theme=gr.themes.Soft(primary_hue="pink", secondary_hue="blue")) as demo:
|
| 129 |
+
# Fonts & CSS
|
| 130 |
gr.Markdown(
|
| 131 |
"""
|
| 132 |
<link href="https://fonts.googleapis.com/css2?family=Comic+Neue&display=swap" rel="stylesheet">
|
|
|
|
| 156 |
</style>
|
| 157 |
<div class='title-text'>π§ Kasoti - The Mind Reading Game</div>
|
| 158 |
<p class='subtitle-text'>Think of something and answer my yes/no questions β let's see if I can guess it in 20 tries! π΅οΈββοΈ</p>
|
| 159 |
+
"""
|
| 160 |
)
|
| 161 |
|
| 162 |
with gr.Row():
|
|
|
|
| 180 |
game_history = gr.Textbox(label="π Game Updates", interactive=False, lines=3)
|
| 181 |
final_answer_box = gr.Textbox(label="π― Final Guess", visible=False, lines=2, interactive=False)
|
| 182 |
|
| 183 |
+
# Button logic
|
| 184 |
+
start.click(
|
| 185 |
+
fn=begin_game,
|
| 186 |
+
outputs=[game_q_box, game_history, final_answer_box, submit, final_answer_box, question_progress]
|
| 187 |
+
)
|
| 188 |
+
|
| 189 |
hint_toggle.click(fn=toggle_hint_mode, outputs=[hint_status, game_history])
|
| 190 |
hint_toggle.click(fn=hint_response, outputs=[game_history])
|
| 191 |
transcribe.click(fn=convert_audio_to_text, inputs=[mic_input, lang_sel], outputs=[typed_ans])
|
| 192 |
+
|
| 193 |
+
submit.click(
|
| 194 |
+
fn=interpret_answer,
|
| 195 |
+
inputs=[typed_ans],
|
| 196 |
+
outputs=[game_q_box, typed_ans, final_answer_box, game_history, final_answer_box, question_progress]
|
| 197 |
+
)
|
| 198 |
|
| 199 |
demo.launch()
|