Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
|
@@ -60,7 +60,7 @@ async def on_ready():
|
|
| 60 |
name="ping",
|
| 61 |
description="ping")
|
| 62 |
async def ping(ctx):
|
| 63 |
-
await ctx.
|
| 64 |
|
| 65 |
|
| 66 |
def get_client(session: Optional[str] = None) -> grc.Client:
|
|
@@ -99,7 +99,7 @@ async def text2img(pos_prompt: str, neg_promt: str = "",model="absolutereality_v
|
|
| 99 |
txt2img_args = txt2img_conf.values()
|
| 100 |
job = client.predict(*txt2img_args, fn_index=0)
|
| 101 |
|
| 102 |
-
return job
|
| 103 |
|
| 104 |
|
| 105 |
async def img2img(pos_prompt: str, neg_promt: str = "", img = None,model="absolutereality_v181.safetensors [3d9d4d2b]"):
|
|
@@ -133,7 +133,7 @@ async def img2img(pos_prompt: str, neg_promt: str = "", img = None,model="absolu
|
|
| 133 |
client = await loop.run_in_executor(None, get_client, None)
|
| 134 |
img2img_args = img2img_conf.values()
|
| 135 |
job = client.predict(*img2img_args, fn_index=1)
|
| 136 |
-
return job
|
| 137 |
|
| 138 |
def run_dffusion(pos_prompt: str,neg_promt: str = "",img_url= "",model="absolutereality_v181.safetensors [3d9d4d2b]"):
|
| 139 |
"""Runs the diffusion model."""
|
|
@@ -160,7 +160,7 @@ async def diffusion(ctx, pos_prompt: str="",neg_promt: str = "", img_url= None,i
|
|
| 160 |
# if channel name is == channel_name
|
| 161 |
try:
|
| 162 |
if ctx.channel.name == channel_name:
|
| 163 |
-
await ctx.
|
| 164 |
try :
|
| 165 |
# preparing the prediction before creating the thread
|
| 166 |
_improved_pos_prompt = "ultrarealistic,8k"
|
|
@@ -184,7 +184,7 @@ async def diffusion(ctx, pos_prompt: str="",neg_promt: str = "", img_url= None,i
|
|
| 184 |
|
| 185 |
# need to make sure AI sends the first message
|
| 186 |
result = run_dffusion(pos_prompt , neg_promt,img_url,model=model)
|
| 187 |
-
await ctx.
|
| 188 |
except Exception as e:
|
| 189 |
await ctx.resepond(e)
|
| 190 |
else:
|
|
@@ -203,15 +203,15 @@ async def diffusion(ctx, pos_prompt: str="",neg_promt: str = "", img_url= None,i
|
|
| 203 |
description="setup the bot")
|
| 204 |
async def setup(ctx):
|
| 205 |
"""
|
| 206 |
-
create the #
|
| 207 |
"""
|
| 208 |
# if channel falcon-180b-demo doesn't exist create it
|
| 209 |
if not discord.utils.get(ctx.guild.channels, name=channel_name):
|
| 210 |
await ctx.guild.create_text_channel(channel_name,category=ctx.channel.category)
|
| 211 |
-
await ctx.
|
| 212 |
else:
|
| 213 |
# TODO: tag the channel
|
| 214 |
-
await ctx.
|
| 215 |
|
| 216 |
# running in thread
|
| 217 |
def run_bot():
|
|
|
|
| 60 |
name="ping",
|
| 61 |
description="ping")
|
| 62 |
async def ping(ctx):
|
| 63 |
+
await ctx.reply(f"{bot.latency*1000:.0f}ms")
|
| 64 |
|
| 65 |
|
| 66 |
def get_client(session: Optional[str] = None) -> grc.Client:
|
|
|
|
| 99 |
txt2img_args = txt2img_conf.values()
|
| 100 |
job = client.predict(*txt2img_args, fn_index=0)
|
| 101 |
|
| 102 |
+
return job
|
| 103 |
|
| 104 |
|
| 105 |
async def img2img(pos_prompt: str, neg_promt: str = "", img = None,model="absolutereality_v181.safetensors [3d9d4d2b]"):
|
|
|
|
| 133 |
client = await loop.run_in_executor(None, get_client, None)
|
| 134 |
img2img_args = img2img_conf.values()
|
| 135 |
job = client.predict(*img2img_args, fn_index=1)
|
| 136 |
+
return job
|
| 137 |
|
| 138 |
def run_dffusion(pos_prompt: str,neg_promt: str = "",img_url= "",model="absolutereality_v181.safetensors [3d9d4d2b]"):
|
| 139 |
"""Runs the diffusion model."""
|
|
|
|
| 160 |
# if channel name is == channel_name
|
| 161 |
try:
|
| 162 |
if ctx.channel.name == channel_name:
|
| 163 |
+
await ctx.reply(f"Creating image for {ctx.author.mention} ...")
|
| 164 |
try :
|
| 165 |
# preparing the prediction before creating the thread
|
| 166 |
_improved_pos_prompt = "ultrarealistic,8k"
|
|
|
|
| 184 |
|
| 185 |
# need to make sure AI sends the first message
|
| 186 |
result = run_dffusion(pos_prompt , neg_promt,img_url,model=model)
|
| 187 |
+
await ctx.channel.send(file=discord.File(result))
|
| 188 |
except Exception as e:
|
| 189 |
await ctx.resepond(e)
|
| 190 |
else:
|
|
|
|
| 203 |
description="setup the bot")
|
| 204 |
async def setup(ctx):
|
| 205 |
"""
|
| 206 |
+
create the #channel_name channel
|
| 207 |
"""
|
| 208 |
# if channel falcon-180b-demo doesn't exist create it
|
| 209 |
if not discord.utils.get(ctx.guild.channels, name=channel_name):
|
| 210 |
await ctx.guild.create_text_channel(channel_name,category=ctx.channel.category)
|
| 211 |
+
await ctx.reply(channel_name)
|
| 212 |
else:
|
| 213 |
# TODO: tag the channel
|
| 214 |
+
await ctx.reply(f"{channel_name} channel already exist")
|
| 215 |
|
| 216 |
# running in thread
|
| 217 |
def run_bot():
|