seawolf2357 commited on
Commit
cda5fab
โ€ข
1 Parent(s): 64aed6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -8,7 +8,6 @@ import torch
8
  from diffusers import DiffusionPipeline
9
  import io
10
  from PIL import Image
11
- import time
12
 
13
  # ๋กœ๊น… ์„ค์ •
14
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s: %(message)s', handlers=[logging.StreamHandler()])
@@ -20,8 +19,8 @@ intents.message_content = True
20
  # ๋ฒˆ์—ญ ํŒŒ์ดํ”„๋ผ์ธ ์„ค์ •
21
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
22
 
23
- # ํ™˜๊ฒฝ ๋ณ€์ˆ˜์—์„œ ์ง€์ •๋œ ์ฑ„๋„ ID ๊ฐ€์ ธ์˜ค๊ธฐ
24
- TARGET_CHANNEL_ID = int(os.getenv('TARGET_CHANNEL_ID')) # ์ฑ„๋„ ID๋Š” ์ •์ˆ˜ํ˜•์ด์–ด์•ผ ํ•จ
25
 
26
  # ๊ณ ์ •๋œ ๋„ค๊ฑฐํ‹ฐ๋ธŒ ํ”„๋กฌํ”„ํŠธ
27
  negative_prompt = "blur, low quality, bad composition, ugly, disfigured, weird colors, low quality, jpeg artifacts, lowres, grainy, deformed structures, blurry, opaque, low contrast, distorted details, details are low"
@@ -45,7 +44,6 @@ def generate_image(prompt, negative_prompt):
45
  combined_prompt = f"{prompt}. {negative_prompt}"
46
  result = pipeline(combined_prompt)
47
  image = result.images[0] # ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€ ์„ ํƒ
48
- # ์ด๋ฏธ์ง€ URL ๋Œ€์‹  ์ด๋ฏธ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์ˆ˜์ •
49
  return image
50
 
51
  class MyClient(discord.Client):
@@ -85,3 +83,4 @@ if __name__ == "__main__":
85
  discord_token = os.getenv('DISCORD_TOKEN')
86
  discord_client = MyClient(intents=intents)
87
  discord_client.run(discord_token)
 
 
8
  from diffusers import DiffusionPipeline
9
  import io
10
  from PIL import Image
 
11
 
12
  # ๋กœ๊น… ์„ค์ •
13
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s: %(message)s', handlers=[logging.StreamHandler()])
 
19
  # ๋ฒˆ์—ญ ํŒŒ์ดํ”„๋ผ์ธ ์„ค์ •
20
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
21
 
22
+ # ํ™˜๊ฒฝ ๋ณ€์ˆ˜์—์„œ ์ง€์ •๋œ ์ฑ„๋„ ID ๊ฐ€์ ธ์˜ค๊ธฐ, ๊ธฐ๋ณธ๊ฐ’ ์‚ฌ์šฉ
23
+ TARGET_CHANNEL_ID = int(os.getenv('TARGET_CHANNEL_ID', '123456789012345678')) # ๊ธฐ๋ณธ๊ฐ’ ์‚ฌ์šฉ, ์‹ค์ œ ์ฑ„๋„ ID๋กœ ๋Œ€์ฒด ํ•„์š”
24
 
25
  # ๊ณ ์ •๋œ ๋„ค๊ฑฐํ‹ฐ๋ธŒ ํ”„๋กฌํ”„ํŠธ
26
  negative_prompt = "blur, low quality, bad composition, ugly, disfigured, weird colors, low quality, jpeg artifacts, lowres, grainy, deformed structures, blurry, opaque, low contrast, distorted details, details are low"
 
44
  combined_prompt = f"{prompt}. {negative_prompt}"
45
  result = pipeline(combined_prompt)
46
  image = result.images[0] # ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€ ์„ ํƒ
 
47
  return image
48
 
49
  class MyClient(discord.Client):
 
83
  discord_token = os.getenv('DISCORD_TOKEN')
84
  discord_client = MyClient(intents=intents)
85
  discord_client.run(discord_token)
86
+