iisadia commited on
Commit
2dc8811
·
verified ·
1 Parent(s): 4f38461

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -127,7 +127,8 @@ def ask_llama(conversation_history, category, is_final_guess=False):
127
  6. For objects: ask about size, color, usage, material, or where it's found.
128
  7. Never repeat questions and always make progress toward guessing.
129
  8. If the guess is generic (e.g. "bed") and the player confirms it with "yes", end the game.
130
- 9. If the guess is generic but the answer is "no", ask additional questions to refine the guess."""
 
131
 
132
  if is_final_guess:
133
  prompt = f"""Based on these answers about a {category}, provide ONLY your final guess with no extra text:
@@ -262,7 +263,7 @@ def main():
262
  st.session_state.current_q += 1
263
 
264
  # Stop after 20 questions max
265
- if st.session_state.current_q >= 20:
266
  st.session_state.game_state = "result"
267
 
268
  st.rerun()
@@ -311,6 +312,8 @@ def main():
311
  {"role": "assistant", "content": next_response}
312
  )
313
  st.session_state.current_q += 1
 
 
314
  st.rerun()
315
 
316
  # Result screen
@@ -342,4 +345,4 @@ def main():
342
  st.rerun()
343
 
344
  if __name__ == "__main__":
345
- main()
 
127
  6. For objects: ask about size, color, usage, material, or where it's found.
128
  7. Never repeat questions and always make progress toward guessing.
129
  8. If the guess is generic (e.g. "bed") and the player confirms it with "yes", end the game.
130
+ 9. If the guess is generic but the answer is "no", ask additional questions to refine the guess.
131
+ 10. After a rejected final guess, continue asking questions instead of making new guesses immediately."""
132
 
133
  if is_final_guess:
134
  prompt = f"""Based on these answers about a {category}, provide ONLY your final guess with no extra text:
 
263
  st.session_state.current_q += 1
264
 
265
  # Stop after 20 questions max
266
+ if st.session_state.current_q >= 19:
267
  st.session_state.game_state = "result"
268
 
269
  st.rerun()
 
312
  {"role": "assistant", "content": next_response}
313
  )
314
  st.session_state.current_q += 1
315
+ if st.session_state.current_q >= 19:
316
+ st.session_state.game_state = "result"
317
  st.rerun()
318
 
319
  # Result screen
 
345
  st.rerun()
346
 
347
  if __name__ == "__main__":
348
+ main()