lunarflu HF staff commited on
Commit
d0b9f27
1 Parent(s): 08694f1

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -43,14 +43,16 @@ async def on_message(message):
43
  """Backup"""
44
  number_of_messages = number_of_messages + 1
45
  message_link = f"[#{message.channel.name}]({message.jump_url})"
 
46
  try:
47
- job = testclient.submit(message.content, api_name="/predict")
48
  while not job.done():
49
- await asyncio.sleep(0.2)
50
- if job.done():
51
- label = job.outputs()[0]['label']
 
52
  except Exception as e:
53
- print(f"on_message Error: {e}")
54
  dm_message = await lunarflu.send(f"{number_of_messages}| {label} |{message_link} |{message.author}: {message.content}")
55
 
56
  """Antispam"""
 
43
  """Backup"""
44
  number_of_messages = number_of_messages + 1
45
  message_link = f"[#{message.channel.name}]({message.jump_url})"
46
+ msgcnt = message.content
47
  try:
48
+ job = testclient.submit(msgcnt, api_name="/predict")
49
  while not job.done():
50
+ pass
51
+ result = job.result()
52
+ label = result['label']
53
+ print(f"label: {label}")
54
  except Exception as e:
55
+ print(f"testclient error: {e}")
56
  dm_message = await lunarflu.send(f"{number_of_messages}| {label} |{message_link} |{message.author}: {message.content}")
57
 
58
  """Antispam"""