Araeynn commited on
Commit
36fc8d4
1 Parent(s): 2bfac98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -63,6 +63,7 @@ else:
63
 
64
  try:
65
  os.mkdir("data")
 
66
  except:
67
  pass
68
 
@@ -374,9 +375,9 @@ async def on_message(message):
374
  s = f":green[{message.author}]: :violet[{message.content}] :blue[{msgchannel_name}] :orange[{guild_name}]"
375
  if message.author == client.user:
376
  return
377
- sysrp = """GPT4 Correct System:
378
  You are lyre, a discord bot who can generate images and chat with the user. You were made by Araeyn.
379
- Answer in the style of "The Hitchhiker's Guide to the Galaxy" guide in the book by the same name.
380
  Your discord username is lyre#9828.
381
  Use the markdown format for your responses.
382
  Do not excessively use bullet points.
@@ -449,7 +450,14 @@ async def on_message(message):
449
  context = f.read()
450
  with open(f"{guild_name}.guild", "r") as f:
451
  o = f.read()
452
- if str(message.channel.id) in o.split("\n") or guild_name == "Direct" and message.author.id not in bannedUsers:
 
 
 
 
 
 
 
453
  async with msgchannel.typing():
454
  context += f"GPT4 Correct Assistant:"
455
  load = random.choice(
@@ -491,7 +499,7 @@ async def on_message(message):
491
  if imageModel == "Stable Diffusion 2-1":
492
  image, m = (await SD.text_to_image(imgp, negative_prompt=np), "Stable Diffusion 2-1")
493
  elif imageModel == "stable-diffusion-xl-base-1.0":
494
- image, m = (await SDXL.text_to_image(imgp, negative_prompt=np, num_inference_steps=32), "stable-diffusion-xl-base-1.0")
495
  elif imageModel == "sdxl-turbo":
496
  image, m = (await SDXLT.text_to_image(imgp, negative_prompt=np, num_inference_steps=8, guidance_scale=0.0), "sdxl-turbo")
497
  elif imageModel == "sd-turbo":
@@ -509,7 +517,7 @@ async def on_message(message):
509
  )
510
  await e.edit(embed=embed, attachments=[file])
511
  gt = time.time()
512
- image, r = (await RF.image_to_image("image.png", num_inference_steps=8, prompt=imgp, negative_prompt=np), "stable-diffusion-xl-refiner-1.0")
513
  rt = time.time()
514
  embed.set_footer(
515
  text=
 
63
 
64
  try:
65
  os.mkdir("data")
66
+ os.mkdir("usrtime")
67
  except:
68
  pass
69
 
 
375
  s = f":green[{message.author}]: :violet[{message.content}] :blue[{msgchannel_name}] :orange[{guild_name}]"
376
  if message.author == client.user:
377
  return
378
+ sysrp = """GPT4 Correct system:
379
  You are lyre, a discord bot who can generate images and chat with the user. You were made by Araeyn.
380
+ Answer in the style of "The Hitchhiker's Guide to the Galaxy" guide in the book by the same name for the rest of the chat.
381
  Your discord username is lyre#9828.
382
  Use the markdown format for your responses.
383
  Do not excessively use bullet points.
 
450
  context = f.read()
451
  with open(f"{guild_name}.guild", "r") as f:
452
  o = f.read()
453
+ if not os.path.exists(f"usrtime/{message.user}.usr"):
454
+ with open(f"usrtime/{message.user}.usr", "w") as f:
455
+ f.write(str(time.time()))
456
+ with open(f"usrtime/{message.user}.usr", "w") as f:
457
+ b = f.read()
458
+ if str(message.channel.id) in o.split("\n") or guild_name == "Direct" and message.author.id not in bannedUsers and time.time() - int(b) < 5:
459
+ with open(f"usrtime/{message.user}.usr", "w") as f:
460
+ f.write(time.time())
461
  async with msgchannel.typing():
462
  context += f"GPT4 Correct Assistant:"
463
  load = random.choice(
 
499
  if imageModel == "Stable Diffusion 2-1":
500
  image, m = (await SD.text_to_image(imgp, negative_prompt=np), "Stable Diffusion 2-1")
501
  elif imageModel == "stable-diffusion-xl-base-1.0":
502
+ image, m = (await SDXL.text_to_image(imgp, negative_prompt=np, num_inference_steps=64), "stable-diffusion-xl-base-1.0")
503
  elif imageModel == "sdxl-turbo":
504
  image, m = (await SDXLT.text_to_image(imgp, negative_prompt=np, num_inference_steps=8, guidance_scale=0.0), "sdxl-turbo")
505
  elif imageModel == "sd-turbo":
 
517
  )
518
  await e.edit(embed=embed, attachments=[file])
519
  gt = time.time()
520
+ image, r = (await RF.image_to_image("image.png", num_inference_steps=16, prompt=imgp, negative_prompt=np), "stable-diffusion-xl-refiner-1.0")
521
  rt = time.time()
522
  embed.set_footer(
523
  text=