Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
update test for bert
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ XP_PER_MESSAGE = 10 # 100k messages = 1M exp = lvl 100
|
|
19 |
data_file_path = '/data/xp_data.json'
|
20 |
xp_data = {}
|
21 |
""""""
|
22 |
-
|
23 |
|
24 |
@bot.event
|
25 |
async def on_ready():
|
@@ -40,6 +40,9 @@ except FileNotFoundError:
|
|
40 |
"""
|
41 |
|
42 |
|
|
|
|
|
|
|
43 |
|
44 |
def save_xp_data():
|
45 |
with open(data_file_path, 'w') as f:
|
@@ -57,15 +60,11 @@ def load_xp_data():
|
|
57 |
async def on_message(message):
|
58 |
try:
|
59 |
if message.author != bot.user:
|
60 |
-
|
61 |
-
|
62 |
-
pass
|
63 |
-
result = job.result()
|
64 |
-
label = result['label']
|
65 |
-
print(f"message: {message.content} label: {label}")
|
66 |
|
67 |
|
68 |
-
"""AWAIT LEVEL
|
69 |
author_id = str(message.author.id) # dictionary pairs (ID -> TOTAL XP)
|
70 |
xp_data.setdefault(author_id, 0) # default if it doesn't already exist
|
71 |
|
|
|
19 |
data_file_path = '/data/xp_data.json'
|
20 |
xp_data = {}
|
21 |
""""""
|
22 |
+
client = Client("https://lunarflu-bert-test.hf.space/--replicas/kjf2p/")
|
23 |
|
24 |
@bot.event
|
25 |
async def on_ready():
|
|
|
40 |
"""
|
41 |
|
42 |
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
|
47 |
def save_xp_data():
|
48 |
with open(data_file_path, 'w') as f:
|
|
|
60 |
async def on_message(message):
|
61 |
try:
|
62 |
if message.author != bot.user:
|
63 |
+
result = client.predict(message.content, api_name="/predict")
|
64 |
+
print(result)
|
|
|
|
|
|
|
|
|
65 |
|
66 |
|
67 |
+
"""AWAIT LEVEL ALGORITHM OR SOMETHING (MULTIPLE FILES?)"""
|
68 |
author_id = str(message.author.id) # dictionary pairs (ID -> TOTAL XP)
|
69 |
xp_data.setdefault(author_id, 0) # default if it doesn't already exist
|
70 |
|