seawolf2357 commited on
Commit
77de8cc
โ€ข
1 Parent(s): a27405a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -62,7 +62,7 @@ def translate_prompt(prompt):
62
  async def generate_image(prompt, negative_prompt):
63
  combined_prompt = f"{prompt}. {negative_prompt}"
64
  try:
65
- result = await asyncio.get_event_loop().run_in_executor(None, lambda: pipeline(combined_prompt))
66
  image = result.images[0] # ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€ ์„ ํƒ
67
  torch.cuda.empty_cache() # ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ
68
  return image
@@ -88,7 +88,8 @@ async def generate_prompt_from_llm(user_input):
88
 
89
  [์˜ˆ์‹œ] ๋ชฉ๋ก
90
  !image ๋ฌผ์— ๋น ์ง„ ๋ฒ ๋“œ๋กœ๋ฅผ ๊บผ๋‚ด์ฃผ๋Š” ์˜ˆ์ˆ˜๋‹˜. ๋ฐ”๋‹ค ๋ฐฐ๊ฒฝ. ์ดˆ๊ณ ํ•ด์ƒ๋„ 4K. ๋งˆ์Šคํ„ฐํ”ผ์Šค
91
- !image ์ฌ๊ธ€๋ผ์Šค ๋ผ๊ณ  ์ผ๊ด‘์š•ํ•˜๋Š” ๊ณ ์–‘์ด. ๋ฐฐ๊ฒฝ ํ•ด๋ณ€
 
92
  !image ์ฌ๊ธ€๋ผ์Šค ๋ผ๊ณ  ์ผ๊ด‘์š•ํ•˜๋Š” ํฌ๋ฉ”๋ผ๋ฆฌ์•ˆ ๊ฐ•์•„์ง€. ๋ฐฐ๊ฒฝ ํ•ด๋ณ€
93
  !image ์•„๋ฆ„๋‹ค์šด 25์„ธ ๋Ÿฌ์‹œ์•„ ์—ฌ์ž ๋ชจ๋ธ. ์ˆ˜์˜๋ณต ์ฐฉ์šฉ. ๋ชจ๋ธ ํฌ์ฆˆ. ๋ฐ”๋‹ค ๋ฐฐ๊ฒฝ. ์ดˆ๊ณ ํ•ด์ƒ๋„ ์‚ฌ์ง„ ์Šคํƒ€์ผ. ๋ฏธ์†Œ ํ‘œ์ •. ์ „๋ฉด ์‘์‹œ
94
  !image 3D ํ”ฝ์‚ฌ ์Šคํƒ€์ผ. ๊ท€์—ฌ์šด ๊ณ ์Šด๋„์น˜. ๋ฐฐ๊ฒฝ ๋ถ„์ˆ˜
@@ -162,7 +163,9 @@ class MyClient(discord.Client):
162
  finally:
163
  self.is_processing = False
164
  else:
165
- await message.channel.send('์˜ฌ๋ฐ”๋ฅธ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”. ์˜ˆ) "!image ๊ท€์—ฌ์šด ๊ณ ์–‘์ด๊ฐ€ ์ž ์„ ์ž๊ณ ์žˆ๋‹ค." ๋“ฑ์œผ๋กœ ์ž…๋ ฅํ•˜์‹œ๋ฉด ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.')
 
 
166
 
167
  # ๋ด‡ ์‹คํ–‰
168
  if __name__ == "__main__":
@@ -174,3 +177,4 @@ if __name__ == "__main__":
174
 
175
 
176
 
 
 
62
  async def generate_image(prompt, negative_prompt):
63
  combined_prompt = f"{prompt}. {negative_prompt}"
64
  try:
65
+ result = await asyncio.get_event_loop().run_in_executor(None, lambda: pipeline(prompt, negative_prompt=negative_prompt))
66
  image = result.images[0] # ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€ ์„ ํƒ
67
  torch.cuda.empty_cache() # ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ
68
  return image
 
88
 
89
  [์˜ˆ์‹œ] ๋ชฉ๋ก
90
  !image ๋ฌผ์— ๋น ์ง„ ๋ฒ ๋“œ๋กœ๋ฅผ ๊บผ๋‚ด์ฃผ๋Š” ์˜ˆ์ˆ˜๋‹˜. ๋ฐ”๋‹ค ๋ฐฐ๊ฒฝ. ์ดˆ๊ณ ํ•ด์ƒ๋„ 4K. ๋งˆ์Šคํ„ฐํ”ผ์Šค
91
+ !image ์•„๋ฆ„๋‹ค์šด 20์„ธ ํ”„๋ž‘์Šค ์—ฌ์ž ๋ชจ๋ธ. ๊ณจํ”„ ์›จ์–ด ์ฐฉ์šฉ. ๋ชจ๋ธ ํฌ์ฆˆ. ๊ณจํ”„์žฅ ๋ฐฐ๊ฒฝ. ๋ฏธ์†Œ ํ‘œ์ •. ์ •๋ฉด ์‘์‹œ. ๊ณ ํ•ด์ƒ๋„
92
+ !image ์•„๋ฆ„๋‹ค์šด 20์„ธ ์šฐํฌ๋ผ์ด๋‚˜ ์—ฌ์ž ๋ชจ๋ธ. ์Šคํฌ์ธ ์›จ์–ด ์ฐฉ์šฉ. ๋ชจ๋ธ ํฌ์ฆˆ. ๋ฐ”๋‹ค ๋ฐฐ๊ฒฝ. ๋ฏธ์†Œ ํ‘œ์ •. ์ •๋ฉด ์‘์‹œ. ๊ณ ํ•ด์ƒ๋„
93
  !image ์ฌ๊ธ€๋ผ์Šค ๋ผ๊ณ  ์ผ๊ด‘์š•ํ•˜๋Š” ํฌ๋ฉ”๋ผ๋ฆฌ์•ˆ ๊ฐ•์•„์ง€. ๋ฐฐ๊ฒฝ ํ•ด๋ณ€
94
  !image ์•„๋ฆ„๋‹ค์šด 25์„ธ ๋Ÿฌ์‹œ์•„ ์—ฌ์ž ๋ชจ๋ธ. ์ˆ˜์˜๋ณต ์ฐฉ์šฉ. ๋ชจ๋ธ ํฌ์ฆˆ. ๋ฐ”๋‹ค ๋ฐฐ๊ฒฝ. ์ดˆ๊ณ ํ•ด์ƒ๋„ ์‚ฌ์ง„ ์Šคํƒ€์ผ. ๋ฏธ์†Œ ํ‘œ์ •. ์ „๋ฉด ์‘์‹œ
95
  !image 3D ํ”ฝ์‚ฌ ์Šคํƒ€์ผ. ๊ท€์—ฌ์šด ๊ณ ์Šด๋„์น˜. ๋ฐฐ๊ฒฝ ๋ถ„์ˆ˜
 
163
  finally:
164
  self.is_processing = False
165
  else:
166
+ # LLM์„ ์‚ฌ์šฉํ•˜์—ฌ ๋Œ€ํ™”์— ์‘๋‹ต
167
+ response = await generate_prompt_from_llm(message.content)
168
+ await message.channel.send(response)
169
 
170
  # ๋ด‡ ์‹คํ–‰
171
  if __name__ == "__main__":
 
177
 
178
 
179
 
180
+