JudyChoi commited on
Commit
f18fc4e
β€’
1 Parent(s): cbdf362

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -33,6 +33,10 @@ class Stack:
33
  def size(self):
34
  return len(self.items)
35
 
 
 
 
 
36
  stack = Stack()
37
 
38
  # λ°œν™”μ— λͺ…λ Ήμ–΄κ°€ ν¬ν•¨λ˜μ–΄ μžˆλŠ”μ§€ 확인
@@ -41,6 +45,12 @@ def classifier(utterance):
41
 
42
  print(utterance)
43
 
 
 
 
 
 
 
44
  top = stack.peek()
45
 
46
  global_check = re.compile(r'^#global')
@@ -108,7 +118,8 @@ demo = gr.Interface(fn=classifier, inputs="textbox", outputs="textbox",
108
  ["missing"],
109
  ["select tooth 5 buccal mesial pocket depth"],
110
  ["save"],
111
- ["stop listening"]
 
112
  ])
113
 
114
  if __name__ == "__main__":
 
33
  def size(self):
34
  return len(self.items)
35
 
36
+ def clear(self):
37
+ self.items = [] # μŠ€νƒμ„ λΉ„μš°κΈ°
38
+
39
+
40
  stack = Stack()
41
 
42
  # λ°œν™”μ— λͺ…λ Ήμ–΄κ°€ ν¬ν•¨λ˜μ–΄ μžˆλŠ”μ§€ 확인
 
45
 
46
  print(utterance)
47
 
48
+ if utterance == "reset":
49
+ stack.clear()
50
+ stack.push(node_info["items"][0])
51
+ stack.push(node_info["items"][1])
52
+ return str("Reset!")
53
+
54
  top = stack.peek()
55
 
56
  global_check = re.compile(r'^#global')
 
118
  ["missing"],
119
  ["select tooth 5 buccal mesial pocket depth"],
120
  ["save"],
121
+ ["stop listening"],
122
+ ["reset"]
123
  ])
124
 
125
  if __name__ == "__main__":