Spaces:
Sleeping
Sleeping
Perceived speed: show gambits before image
Browse files- app/app.py +11 -5
app/app.py
CHANGED
|
@@ -163,13 +163,19 @@ def _stream_turn(intent, tier, history):
|
|
| 163 |
history[-1]["content"] += delta
|
| 164 |
yield history, gr.update(), *_hidden_btns(), "", *_card_updates(), gr.update()
|
| 165 |
|
| 166 |
-
#
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
if img_future is not None:
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
| 170 |
if pic is not None:
|
| 171 |
-
|
| 172 |
-
yield history, state_md(), *_btn_updates(), "", *_card_updates(), img_up
|
| 173 |
|
| 174 |
|
| 175 |
def begin(env_id, seed, history):
|
|
|
|
| 163 |
history[-1]["content"] += delta
|
| 164 |
yield history, gr.update(), *_hidden_btns(), "", *_card_updates(), gr.update()
|
| 165 |
|
| 166 |
+
# Show the gambit buttons the INSTANT narration + Hobbes are done — don't make
|
| 167 |
+
# the player wait on the slower image. (Buttons in ~8s, not ~17s.)
|
| 168 |
+
yield history, state_md(), *_btn_updates(), "", *_card_updates(), gr.update()
|
| 169 |
+
|
| 170 |
+
# Then let the dream image pop in when it's ready (often already painted under
|
| 171 |
+
# the prose; at worst it lands a few seconds after the buttons).
|
| 172 |
if img_future is not None:
|
| 173 |
+
try:
|
| 174 |
+
pic = img_future.result(timeout=120)
|
| 175 |
+
except Exception:
|
| 176 |
+
pic = None
|
| 177 |
if pic is not None:
|
| 178 |
+
yield history, gr.update(), *_btn_updates(), "", *_card_updates(), gr.update(value=pic, visible=True)
|
|
|
|
| 179 |
|
| 180 |
|
| 181 |
def begin(env_id, seed, history):
|