Skip to content

Commit

Permalink
add kojii bot
Browse files Browse the repository at this point in the history
  • Loading branch information
genekogan committed Sep 19, 2023
1 parent 0eb2d14 commit 0e71ae8
Show file tree
Hide file tree
Showing 8 changed files with 692 additions and 25 deletions.
55 changes: 38 additions & 17 deletions bots/banny/banny.py
Expand Up @@ -92,7 +92,7 @@ async def create(
# default=False,
# ),
):
print("Received create:", text_input)
print("Received create for Banny:", text_input)

if not self.perm_check(ctx):
await ctx.respond("This command is not available in this channel.")
Expand All @@ -107,8 +107,8 @@ async def create(

source = self.get_source(ctx)
large, fast = False, False
width, height, upscale_f = self.get_dimensions(aspect_ratio, large, img_mode = True)
steps = 30 if fast else 60
width, height, upscale_f = self.get_dimensions(aspect_ratio, large)
steps = 15 if fast else 40

config = StableDiffusionConfig(
generator_name="create",
Expand All @@ -122,9 +122,14 @@ async def create(
)

if "banny" in text_input.lower():
config.lora = 'Banny1p'
config.lora = '6509cd50762edacfc4ef8434'
config.lora_scale = 0.8
config.text_input = re.sub(r'\b(banny)\b', f'<{config.lora}>', text_input, flags=re.IGNORECASE)


print("Y 22 O!!!")
print(config)
print("seed")
print(config.seed)

start_bot_message = f"**{text_input}** - <@!{ctx.author.id}>\n"
await ctx.respond("Starting to create...")
Expand Down Expand Up @@ -160,8 +165,8 @@ async def remix(

source = self.get_source(ctx)

steps = 80
width, height = 960, 640
steps = 50
width, height = 1024, 1024

config = StableDiffusionConfig(
generator_name="remix",
Expand All @@ -175,6 +180,9 @@ async def remix(
seed=random.randint(1, 1e8)
)

config.lora = '6509cd50762edacfc4ef8434'
config.lora_scale = 0.8

start_bot_message = f"**Remix** by <@!{ctx.author.id}>\n"
await ctx.respond("Remixing...")
message = await ctx.channel.send(start_bot_message)
Expand Down Expand Up @@ -218,8 +226,8 @@ async def real2real(
random.randint(1, 1e8) for _ in interpolation_init_images
]
n_frames = 60
steps = 50
width, height = 578, 578
steps = 40
width, height = 768, 768

config = StableDiffusionConfig(
generator_name="real2real",
Expand All @@ -237,12 +245,13 @@ async def real2real(
height=height,
steps=steps,
guidance_scale=7.5,
scale_modulation=0.1,
latent_smoothing_std=0.01,
seed=random.randint(1, 1e8),
interpolation_init_images_min_strength = 0.3, # a higher value will make the video smoother, but allows less visual change / journey
)

config.lora = '6509cd50762edacfc4ef8434'
config.lora_scale = 0.8

start_bot_message = f"**Real2Real** by <@!{ctx.author.id}>\n"
await ctx.respond("Lerping...")
message = await ctx.channel.send(start_bot_message)
Expand Down Expand Up @@ -295,8 +304,8 @@ async def lerp(
interpolation_texts = [text_input1, text_input2]
interpolation_seeds = [random.randint(1, 1e8) for _ in interpolation_texts]
n_frames = 80
steps = 50
width, height, upscale_f = self.get_dimensions(aspect_ratio, False, img_mode = False)
steps = 40
width, height, upscale_f = self.get_video_dimensions(aspect_ratio, False)

config = StableDiffusionConfig(
generator_name="interpolate",
Expand All @@ -314,11 +323,13 @@ async def lerp(
sampler="euler",
steps=steps,
guidance_scale=7.5,
scale_modulation=0.1,
latent_smoothing_std=0.01,
seed=random.randint(1, 1e8),
)

if "banny" in interpolation_texts[0].lower() or "banny" in interpolation_texts[1].lower():
config.lora = '6509cd50762edacfc4ef8434'
config.lora_scale = 0.8

start_bot_message = (
f"**{text_input1}** to **{text_input2}** - <@!{ctx.author.id}>\n"
)
Expand Down Expand Up @@ -436,14 +447,24 @@ def message_preprocessor(self, message: discord.Message) -> str:
message_content = message_content.strip()
return message_content

def get_dimensions(self, aspect_ratio, large, img_mode = True):
def get_video_dimensions(self, aspect_ratio):
if aspect_ratio == "square":
width, height = 1024, 1024
elif aspect_ratio == "landscape":
width, height = 1280, 768
elif aspect_ratio == "portrait":
width, height = 768, 1280
upscale_f = 1.0
return width, height, upscale_f

def get_dimensions(self, aspect_ratio, large):
if aspect_ratio == "square":
width, height = 768, 768
elif aspect_ratio == "landscape":
width, height = 960, 640
elif aspect_ratio == "portrait":
width, height = 640, 960
upscale_f = 1.4 if large and img_mode else 1.0
upscale_f = 1.4 if large else 1.0
return width, height, upscale_f

def perm_check(self, ctx):
Expand Down
26 changes: 18 additions & 8 deletions bots/eden_bot/eden_bot.py
Expand Up @@ -202,8 +202,8 @@ async def create(

source = self.get_source(ctx)
large, fast = False, False
width, height, upscale_f = self.get_dimensions(aspect_ratio, large, img_mode = True)
steps = 35 if fast else 60
width, height, upscale_f = self.get_dimensions(aspect_ratio, large)
steps = 15 if fast else 40

config = StableDiffusionConfig(
generator_name="create",
Expand Down Expand Up @@ -309,7 +309,7 @@ async def real2real(
]
n_frames = 50
steps = 40
width, height = 1024, 1024
width, height = 768, 768

config = StableDiffusionConfig(
generator_name="real2real",
Expand Down Expand Up @@ -384,7 +384,7 @@ async def lerp(
interpolation_seeds = [random.randint(1, 1e8) for _ in interpolation_texts]
n_frames = 50
steps = 40
width, height, upscale_f = self.get_dimensions(aspect_ratio, False, img_mode = False)
width, height, upscale_f = self.get_video_dimensions(aspect_ratio, False)

config = StableDiffusionConfig(
generator_name="interpolate",
Expand Down Expand Up @@ -528,14 +528,24 @@ def message_preprocessor(self, message: discord.Message) -> str:
message_content = message_content.strip()
return message_content

def get_dimensions(self, aspect_ratio, large, img_mode = True):
def get_video_dimensions(self, aspect_ratio):
if aspect_ratio == "square":
width, height = 1024, 1024
elif aspect_ratio == "landscape":
width, height = 1024+512, 1024
width, height = 1280, 768
elif aspect_ratio == "portrait":
width, height = 768, 1280
upscale_f = 1.0
return width, height, upscale_f

def get_dimensions(self, aspect_ratio, large):
if aspect_ratio == "square":
width, height = 768, 768
elif aspect_ratio == "landscape":
width, height = 960, 640
elif aspect_ratio == "portrait":
width, height = 1024, 1024+512
upscale_f = 1.4 if large and img_mode else 1.0
width, height = 640, 960
upscale_f = 1.4 if large else 1.0
return width, height, upscale_f

def perm_check(self, ctx):
Expand Down
4 changes: 4 additions & 0 deletions bots/kojii/.gitignore
@@ -0,0 +1,4 @@
.env
results
__pycache__
output
52 changes: 52 additions & 0 deletions bots/kojii/channels.py
@@ -0,0 +1,52 @@
# GUILDS

BRAINDROPS_GUILD_ID = 905257386976112701
ABRAHAM_GUILD_ID = 573691888050241543
MARS_COLLEGE_GUILD_ID = 741757454894891068
JMILL_GROUP_GUILD_ID = 616345730839216132
GENEKOGAN_GUILD_ID = 758719600895590441
DEADAVATARS_GUILD_ID = 883025460613754890
ABRAHAM_BOTDEV_GUILD_ID = 1006143747588898846
VIRTUALBEINGS_GUILD_ID = 1031984759284432956

# CHANNELS

GENE_GENERAL = 758719600895590444

MARS_BOTS = 912606469931814923
MARS_BOTSPAM = 929241588687863838
MARS_ABRAHAM = 911133638245117993
MARS_AI = 901788531184255026
MARS_2023_EDEN = 994782796163850323

BRAINDROPS_ABRAHAM = 911132169437577216
BRAINDROPS_GENE = 909925591589990513
BRAINDROPS_STABLEDIFFUSION = 1000597251023962222

ABRAHAM_ABRAHAM = 911125237184204810
ABRAHAM_EDEN = 1003581679916548207
ABRAHAM_CORE_EDEN = 1004656589124415518
ABRAHAM_DEVS_GENERAL = 898297428011266080
ABRAHAM_DEVS_GATEWAY = 898291497911353384
ABRAHAM_DEVS_FRONTEND = 898291520975826964
ABRAHAM_DEVS_EDEN = 917084656782954557
ABRAHAM_DEVS_GENERATOR = 932524789636169728
ABRAHAM_DEVS_BOTS = 984944839542059019

LITTLE_MARTIANS_GENERAL = 976158687968251955
LITTLE_MARTIANS_WELCOME = 976158687506890794
LITTLE_MARTIANS_IDEASANDFEEDBACK = 976158687968251957
LITTLE_MARTIANS_YOURLITTLEMARTIANSSTORY = 976161026259157103
LITTLE_MARTIANS_TOKENOMICS = 976161178667614208
LITTLE_MARTIANS_TOOLS = 976908851213385808

DEADAVATARS_ABRAHAM = 912743080581537842
EYEO_ABRAHAM = 987033586580484206
TOKENARTNYC_ABRAHAM = 986768571004768306
JMILL_GROUP_CHAT_ART = 991811756630487190
DEADAVATARS_ABRAHAMAI = 912743080581537842
DEADAVATARS_GARDENOFEDEN = 1020892084468731904
VIRTUALBEINGS_EDEN = 1052993617242902528

ABRAHAM_BOTDEV_ABRAHAM = 1006144058940469268
ABRAHAM_BOTDEV_GENERAL = 1006143747588898849
48 changes: 48 additions & 0 deletions bots/kojii/config.py
@@ -0,0 +1,48 @@
import os

from dotenv import load_dotenv

from . import channels
from . import settings

load_dotenv()

stage = os.environ.get("STAGE", "dev")

config_dict = {
"dev": {
"guilds": [
channels.GENEKOGAN_GUILD_ID,
channels.ABRAHAM_BOTDEV_GUILD_ID,
channels.ABRAHAM_GUILD_ID,
],
"allowed_channels": [
channels.GENE_GENERAL,
channels.ABRAHAM_BOTDEV_ABRAHAM,
channels.ABRAHAM_BOTDEV_GENERAL,
channels.ABRAHAM_EDEN,
channels.ABRAHAM_CORE_EDEN,
],
},
"prod": {
"guilds": [
channels.GENEKOGAN_GUILD_ID,
channels.MARS_COLLEGE_GUILD_ID,
channels.ABRAHAM_GUILD_ID,
channels.BRAINDROPS_GUILD_ID,
channels.DEADAVATARS_GUILD_ID,
channels.VIRTUALBEINGS_GUILD_ID,
],
"allowed_channels": [
channels.GENE_GENERAL,
channels.MARS_2023_EDEN,
channels.MARS_AI,
channels.ABRAHAM_DEVS_BOTS,
channels.ABRAHAM_EDEN,
channels.ABRAHAM_CORE_EDEN,
channels.BRAINDROPS_STABLEDIFFUSION,
channels.DEADAVATARS_GARDENOFEDEN,
channels.VIRTUALBEINGS_EDEN,
],
},
}

0 comments on commit 0e71ae8

Please sign in to comment.