Boni98 commited on
Commit
794a148
·
1 Parent(s): 0ab67e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -38,9 +38,6 @@ best_guess = None
38
  def respond(message, chat_history, label_value, image_value):
39
  global has_started, best_guess
40
 
41
- if not has_started:
42
- has_started = True
43
-
44
  logits, is_better = clip_chat.answer(message)
45
  bot_message = logit2sentence(logits, clip_chat.goal)
46
 
@@ -51,15 +48,19 @@ def respond(message, chat_history, label_value, image_value):
51
  best_guess = "YOU WIN! (Press \"Reset\" to play again)"
52
  image_value = clip_chat.image_org
53
  else:
54
- if is_better == -1:
55
- bot_message += ""
56
- elif is_better == 0:
57
- bot_message += "You did worse than the last one."
58
- elif is_better == 1 or is_better == 3:
59
- bot_message += "You did better than the last one."
 
60
 
61
  label_value = best_guess
62
 
 
 
 
63
  chat_history.append((message, bot_message))
64
  return "", chat_history, label_value, image_value
65
 
 
38
  def respond(message, chat_history, label_value, image_value):
39
  global has_started, best_guess
40
 
 
 
 
41
  logits, is_better = clip_chat.answer(message)
42
  bot_message = logit2sentence(logits, clip_chat.goal)
43
 
 
48
  best_guess = "YOU WIN! (Press \"Reset\" to play again)"
49
  image_value = clip_chat.image_org
50
  else:
51
+ if has_started:
52
+ if is_better == -1:
53
+ bot_message += ""
54
+ elif is_better == 0:
55
+ bot_message += "You did worse than the last one."
56
+ elif is_better == 1 or is_better == 3:
57
+ bot_message += "You did better than the last one."
58
 
59
  label_value = best_guess
60
 
61
+ if not has_started:
62
+ has_started = True
63
+
64
  chat_history.append((message, bot_message))
65
  return "", chat_history, label_value, image_value
66