lunarflu HF staff commited on
Commit
5f2195d
1 Parent(s): 460fb29

test = Client("https://lunarflu-bert-test.hf.space/--replicas/58fjw/")

Browse files
Files changed (1) hide show
  1. app.py +9 -1
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():
@@ -57,6 +57,14 @@ def load_xp_data():
57
  async def on_message(message):
58
  try:
59
  if message.author != bot.user:
 
 
 
 
 
 
 
 
60
  """AWAIT LEVEL ALGORITM OR SOMETHING (MULTIPLE FILES?)"""
61
  author_id = str(message.author.id) # dictionary pairs (ID -> TOTAL XP)
62
  xp_data.setdefault(author_id, 0) # default if it doesn't already exist
 
19
  data_file_path = '/data/xp_data.json'
20
  xp_data = {}
21
  """"""
22
+ test = Client("https://lunarflu-bert-test.hf.space/--replicas/58fjw/")
23
 
24
  @bot.event
25
  async def on_ready():
 
57
  async def on_message(message):
58
  try:
59
  if message.author != bot.user:
60
+ job = test.submit(message.content, api_name="/predict")
61
+ while not job.done():
62
+ pass
63
+ result = job.result()
64
+ label = result['label']
65
+ print(f"message: {message.content} label: {label}")
66
+
67
+
68
  """AWAIT LEVEL ALGORITM OR SOMETHING (MULTIPLE FILES?)"""
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