Rifat Azad commited on
Commit
0305255
·
1 Parent(s): 21b9666
Files changed (2) hide show
  1. Dockerfile +2 -0
  2. pydvpl_bot.py +2 -6
Dockerfile CHANGED
@@ -1,5 +1,7 @@
1
  FROM python:3.12-slim
2
 
 
 
3
  WORKDIR /code
4
 
5
  RUN pip install --no-cache-dir -U discord.py pydvpl fastapi uvicorn psutil python-dotenv python-tgpt craiyon.py
 
1
  FROM python:3.12-slim
2
 
3
+ RUN sed -i '1s/^/nameserver 1.1.1.1\n/' /etc/resolv.conf
4
+
5
  WORKDIR /code
6
 
7
  RUN pip install --no-cache-dir -U discord.py pydvpl fastapi uvicorn psutil python-dotenv python-tgpt craiyon.py
pydvpl_bot.py CHANGED
@@ -19,7 +19,6 @@ from craiyon import Craiyon, craiyon_utils
19
  from io import BytesIO
20
  import base64
21
  import craiyon
22
- import aiohttp
23
 
24
 
25
 
@@ -579,9 +578,6 @@ async def chat(ctx, model, *, message):
579
  # FUNCTION ------------------------------------------------------ SPLIT
580
 
581
 
582
- # Create a global aiohttp.ClientSession object
583
- session = aiohttp.ClientSession()
584
-
585
  @bot.hybrid_command(help="Generate images with 'craiyon' ai.")
586
  async def image(ctx, *, prompt: str):
587
  # Check if the user is authorized to use the command
@@ -593,8 +589,8 @@ async def image(ctx, *, prompt: str):
593
  await ctx.send(f"Generating images for prompt: `{prompt}`. Please be patient...")
594
 
595
  try:
596
- generator = Craiyon() # Instantiate Craiyon without passing a session
597
- generated_images = await generator.async_generate(prompt, session=session) # Pass the session object here
598
 
599
  # Encode images to base64
600
  b64_list = await craiyon_utils.async_encode_base64(generated_images.images)
 
19
  from io import BytesIO
20
  import base64
21
  import craiyon
 
22
 
23
 
24
 
 
578
  # FUNCTION ------------------------------------------------------ SPLIT
579
 
580
 
 
 
 
581
  @bot.hybrid_command(help="Generate images with 'craiyon' ai.")
582
  async def image(ctx, *, prompt: str):
583
  # Check if the user is authorized to use the command
 
589
  await ctx.send(f"Generating images for prompt: `{prompt}`. Please be patient...")
590
 
591
  try:
592
+ generator = Craiyon()
593
+ generated_images = await generator.async_generate(prompt)
594
 
595
  # Encode images to base64
596
  b64_list = await craiyon_utils.async_encode_base64(generated_images.images)