Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ def convert_to_timezone(dt, tz):
|
|
24 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
25 |
intents = discord.Intents.all()
|
26 |
bot = commands.Bot(command_prefix='!', intents=intents)
|
27 |
-
|
28 |
|
29 |
#rate_limiter = RateLimiter(max_calls=10, period=60) # needs testing
|
30 |
|
@@ -43,17 +43,8 @@ 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 |
-
msgcnt = message.content
|
47 |
-
|
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"""
|
59 |
#Detecting certain unwanted strings
|
|
|
24 |
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
|
25 |
intents = discord.Intents.all()
|
26 |
bot = commands.Bot(command_prefix='!', intents=intents)
|
27 |
+
|
28 |
|
29 |
#rate_limiter = RateLimiter(max_calls=10, period=60) # needs testing
|
30 |
|
|
|
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 |
+
dm_message = await lunarflu.send(f"{number_of_messages}|{message_link} |{message.author}: {message.content}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
"""Antispam"""
|
50 |
#Detecting certain unwanted strings
|