tommy24 commited on
Commit
e300076
·
1 Parent(s): 206df47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -518,6 +518,8 @@ messages = [
518
  ]
519
 
520
  def classify(platform, UserInput, Images, Textbox2, Textbox3):
 
 
521
  if Textbox3 == code:
522
  imageData = None
523
  if Images != "None":
@@ -557,8 +559,9 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
557
  messages.append({"role": "user", "content": UserInput})
558
 
559
  # Pop earlier messages if there are more than 10
560
- while len(messages) > 10:
561
- messages.pop(0)
 
562
 
563
  for i, label in enumerate(labels):
564
  prediction_value = float(prediction[0][i])
@@ -618,8 +621,9 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
618
  messages.append({"role": "user", "content": UserInput})
619
 
620
  # Pop earlier messages if there are more than 10
621
- while len(messages) > 10:
622
- messages.pop(0)
 
623
 
624
  headers = {
625
  "Content-Type": "application/json",
 
518
  ]
519
 
520
  def classify(platform, UserInput, Images, Textbox2, Textbox3):
521
+ if UserInput.lower() == "clear history":
522
+ messages.clear()
523
  if Textbox3 == code:
524
  imageData = None
525
  if Images != "None":
 
559
  messages.append({"role": "user", "content": UserInput})
560
 
561
  # Pop earlier messages if there are more than 10
562
+ # if UserInput.lower() == "clear history":
563
+ # while len(messages) > 10:
564
+ # messages.pop(0)
565
 
566
  for i, label in enumerate(labels):
567
  prediction_value = float(prediction[0][i])
 
621
  messages.append({"role": "user", "content": UserInput})
622
 
623
  # Pop earlier messages if there are more than 10
624
+ # if UserInput.lower() == "clear history":
625
+ # while len(messages) > 10:
626
+ # messages.pop(0)
627
 
628
  headers = {
629
  "Content-Type": "application/json",