@ -83,10 +83,15 @@ class Callbacks(object):
print ( event )
print ( event )
await self . bot . send_message ( self . client , room . room_id , " Hello World! " )
await self . bot . send_message ( self . client , room . room_id , " Hello World! " )
return
return
elif event . body == " !image " or event . body . startswith ( ' !image ' ) or event . body . startswith ( ' !image1 ' ) :
prompt = event . body . removeprefix ( ' !image ' ) . removeprefix ( ' !image1 ' ) . strip ( )
elif re . search ( " ^!image(?P<num>[0-9])( \ s(?P<cmd>.*))?$ " , event . body ) :
negative_prompt = " out of frame, (ugly:1.3), (fused fingers), (too many fingers), (bad anatomy:1.5), (watermark:1.5), (words), letters, untracked eyes, asymmetric eyes, floating head, (logo:1.5), (bad hands:1.3), (mangled hands:1.2), (missing hands), (missing arms), backward hands, floating jewelry, unattached jewelry, floating head, doubled head, unattached head, doubled head, head in body, (misshapen body:1.1), (badly fitted headwear:1.2), floating arms, (too many arms:1.5), limbs fused with body, (facial blemish:1.5), badly fitted clothes, imperfect eyes, untracked eyes, crossed eyes, hair growing from clothes, partial faces, hair not attached to head "
m = re . search ( " ^!image(?P<num>[0-9])?( \ s(?P<cmd>.*))?$ " , event . body )
if len ( prompt ) > 0 :
if m [ ' num ' ] :
num = int ( m [ ' num ' ] )
else :
num = 1
if m [ ' cmd ' ] :
prompt = m [ ' cmd ' ] . strip ( )
if self . bot . image_prompt :
if self . bot . image_prompt :
prompt . replace ( self . bot . name , self . bot . image_prompt )
prompt . replace ( self . bot . name , self . bot . image_prompt )
else :
else :
@ -94,75 +99,43 @@ class Callbacks(object):
prompt = self . bot . image_prompt
prompt = self . bot . image_prompt
else :
else :
prompt = " a beautiful woman "
prompt = " a beautiful woman "
if self . bot . service == " runpod " :
if num == 1 :
output = await ai . generate_image1 ( prompt , negative_prompt , self . bot . runpod_api_key )
negative_prompt = " out of frame, (ugly:1.3), (fused fingers), (too many fingers), (bad anatomy:1.5), (watermark:1.5), (words), letters, untracked eyes, asymmetric eyes, floating head, (logo:1.5), (bad hands:1.3), (mangled hands:1.2), (missing hands), (missing arms), backward hands, floating jewelry, unattached jewelry, floating head, doubled head, unattached head, doubled head, head in body, (misshapen body:1.1), (badly fitted headwear:1.2), floating arms, (too many arms:1.5), limbs fused with body, (facial blemish:1.5), badly fitted clothes, imperfect eyes, untracked eyes, crossed eyes, hair growing from clothes, partial faces, hair not attached to head "
elif self . bot . service == " stablehorde " :
output = await ai . generate_image1 ( prompt , negative_prompt , self . bot . stablehorde_api_key )
else :
else :
pass
for imagefile in output :
await self . bot . send_image ( self . client , room . room_id , imagefile )
return
elif event . body . startswith ( ' !image2 ' ) :
prompt = event . body . removeprefix ( ' !image2 ' ) . strip ( )
negative_prompt = " ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face "
negative_prompt = " ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face "
if len ( prompt ) > 0 :
# else:
if self . bot . image_prompt :
# negative_prompt = "ugly, out of frame"
prompt . replace ( self . bot . name , self . bot . image_prompt )
else :
if self . bot . image_prompt :
prompt = self . bot . image_prompt
else :
prompt = " a beautiful woman "
if self . bot . service == " runpod " :
if self . bot . service == " runpod " :
if num == 1 :
output = await ai . generate_image1 ( prompt , negative_prompt , self . bot . runpod_api_key )
elif num == 2 :
output = await ai . generate_image2 ( prompt , negative_prompt , self . bot . runpod_api_key )
output = await ai . generate_image2 ( prompt , negative_prompt , self . bot . runpod_api_key )
elif self . bot . service == " stablehorde " :
elif num == 3 :
output = await ai . generate_image2 ( prompt , negative_prompt , self . bot . stablehorde_api_key )
output = await ai . generate_image3 ( prompt , negative_prompt , self . bot . runpod_api_key )
elif num == 4 :
output = await ai . generate_image4 ( prompt , negative_prompt , self . bot . runpod_api_key )
elif num == 5 :
output = await ai . generate_image5 ( prompt , negative_prompt , self . bot . runpod_api_key )
elif num == 6 :
output = await ai . generate_image6 ( prompt , negative_prompt , self . bot . runpod_api_key )
else :
else :
pass
for imagefile in output :
await self . bot . send_image ( self . client , room . room_id , imagefile )
return
return
elif event . body . startswith ( ' !image3 ' ) :
prompt = event . body . removeprefix ( ' !image3 ' ) . strip ( )
negative_prompt = " ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face "
if len ( prompt ) > 0 :
if self . bot . image_prompt :
prompt . replace ( self . bot . name , self . bot . image_prompt )
else :
if self . bot . image_prompt :
prompt = self . bot . image_prompt
else :
prompt = " a beautiful woman "
if self . bot . service == " runpod " :
output = await ai . generate_image3 ( prompt , negative_prompt , self . bot . runpod_api_key )
elif self . bot . service == " stablehorde " :
elif self . bot . service == " stablehorde " :
if num == 1 :
output = await ai . generate_image1 ( prompt , negative_prompt , self . bot . stablehorde_api_key )
elif num == 2 :
output = await ai . generate_image2 ( prompt , negative_prompt , self . bot . stablehorde_api_key )
elif num == 3 :
output = await ai . generate_image3 ( prompt , negative_prompt , self . bot . stablehorde_api_key )
output = await ai . generate_image3 ( prompt , negative_prompt , self . bot . stablehorde_api_key )
else :
else :
pass
for imagefile in output :
await self . bot . send_image ( self . client , room . room_id , imagefile )
return
return
elif event . body . startswith ( ' !image4 ' ) :
prompt = event . body . removeprefix ( ' !image4 ' ) . strip ( )
negative_prompt = " ugly, out of frame "
if len ( prompt ) > 0 :
if self . bot . image_prompt :
prompt . replace ( self . bot . name , self . bot . image_prompt )
else :
if self . bot . image_prompt :
prompt = self . bot . image_prompt
else :
else :
prompt = " a beautiful woman "
return
if self . bot . service == " runpod " :
output = await ai . generate_image_automatic ( prompt , negative_prompt , " https://api.runpod.ai/v1/lxdhmiccp3vdsf/ " , self . bot . runpod_api_key )
elif self . bot . service == " stablehorde " :
pass
else :
pass
for imagefile in output :
for imagefile in output :
await self . bot . send_image ( self . client , room . room_id , imagefile )
await self . bot . send_image ( self . client , room . room_id , imagefile )
return
return
elif event . body . startswith ( ' !begin ' ) :
elif event . body . startswith ( ' !begin ' ) :
self . bot . chat_history . room ( room . display_name ) . clear ( )
self . bot . chat_history . room ( room . display_name ) . clear ( )
self . bot . room_config [ room . room_id ] [ " tick " ] = 0
self . bot . room_config [ room . room_id ] [ " tick " ] = 0