Update app.py
Browse files
app.py
CHANGED
@@ -54,10 +54,11 @@ words = [
|
|
54 |
|
55 |
class WordGame:
|
56 |
|
57 |
-
def __init__(self):
|
58 |
self.points = 0
|
59 |
self.target_word = ""
|
60 |
self.attempts = 3
|
|
|
61 |
self.generate_task()
|
62 |
|
63 |
def generate_task(self):
|
@@ -102,11 +103,12 @@ class WordGame:
|
|
102 |
return "That didn't quite hit the mark. Try again!"
|
103 |
|
104 |
def update_status(self, message=""):
|
|
|
|
|
105 |
return f'Current score: {self.points}, remaining attempts: {self.attempts}, target word: "{self.target_word}" {message}'
|
106 |
|
107 |
|
108 |
|
109 |
-
game = WordGame()
|
110 |
|
111 |
|
112 |
|
@@ -189,5 +191,10 @@ demo = gr.ChatInterface(
|
|
189 |
|
190 |
|
191 |
|
|
|
|
|
|
|
|
|
|
|
192 |
if __name__ == "__main__":
|
193 |
demo.launch()
|
|
|
54 |
|
55 |
class WordGame:
|
56 |
|
57 |
+
def __init__(self, chatbot):
|
58 |
self.points = 0
|
59 |
self.target_word = ""
|
60 |
self.attempts = 3
|
61 |
+
self.chatbot = chatbot
|
62 |
self.generate_task()
|
63 |
|
64 |
def generate_task(self):
|
|
|
103 |
return "That didn't quite hit the mark. Try again!"
|
104 |
|
105 |
def update_status(self, message=""):
|
106 |
+
gr.ChatInterface.update(title=f'The Game - Current score: {self.points}, remaining attempts: {self.attempts}, target word: "{self.target_word}" {message}')
|
107 |
+
#chatbot.ChatInterface.update(title=f'The Game - Current score: {self.points}, remaining attempts: {self.attempts}, target word: "{self.target_word}" {message}')
|
108 |
return f'Current score: {self.points}, remaining attempts: {self.attempts}, target word: "{self.target_word}" {message}'
|
109 |
|
110 |
|
111 |
|
|
|
112 |
|
113 |
|
114 |
|
|
|
191 |
|
192 |
|
193 |
|
194 |
+
game = WordGame(demo)
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
if __name__ == "__main__":
|
200 |
demo.launch()
|