seawolf2357 commited on
Commit
0c17144
Β·
verified Β·
1 Parent(s): b1c63d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -9
app.py CHANGED
@@ -3,7 +3,6 @@ import logging
3
  import os
4
  import uuid
5
  import subprocess
6
- from deep_translator import GoogleTranslator
7
  from gradio_client import Client
8
 
9
  # λ‘œκΉ… μ„€μ •
@@ -39,8 +38,7 @@ class MyClient(discord.Client):
39
  self.is_processing = True
40
  try:
41
  prompt = message.content[len('!image '):]
42
- prompt_en = await translate_prompt(prompt)
43
- image_path = await self.generate_image(prompt_en)
44
  user_id = message.author.id
45
  await message.channel.send(
46
  f"<@{user_id}> λ‹˜μ΄ μš”μ²­ν•˜μ‹  μ΄λ―Έμ§€μž…λ‹ˆλ‹€.",
@@ -80,12 +78,6 @@ class MyClient(discord.Client):
80
  logging.error(f'이미지 생성 도쀑 μ˜ˆμ™Έ λ°œμƒ: {e}')
81
  raise RuntimeError(f"이미지 생성 도쀑 μ˜ˆμ™Έ λ°œμƒ: {str(e)}")
82
 
83
- async def translate_prompt(prompt):
84
- logging.debug(f'ν”„λ‘¬ν”„νŠΈ λ²ˆμ—­ 쀑: {prompt}')
85
- translated_text = GoogleTranslator(source='ko', target='en').translate(prompt)
86
- logging.debug(f'λ²ˆμ—­λœ ν…μŠ€νŠΈ: {translated_text}')
87
- return translated_text
88
-
89
  async def initiate_conversation(prompt, image_path, message):
90
  logging.debug(f'λŒ€ν™” μ‹œμž‘ 쀑: {prompt}')
91
  description = "μƒμ„±λœ μ΄λ―Έμ§€μž…λ‹ˆλ‹€."
 
3
  import os
4
  import uuid
5
  import subprocess
 
6
  from gradio_client import Client
7
 
8
  # λ‘œκΉ… μ„€μ •
 
38
  self.is_processing = True
39
  try:
40
  prompt = message.content[len('!image '):]
41
+ image_path = await self.generate_image(prompt)
 
42
  user_id = message.author.id
43
  await message.channel.send(
44
  f"<@{user_id}> λ‹˜μ΄ μš”μ²­ν•˜μ‹  μ΄λ―Έμ§€μž…λ‹ˆλ‹€.",
 
78
  logging.error(f'이미지 생성 도쀑 μ˜ˆμ™Έ λ°œμƒ: {e}')
79
  raise RuntimeError(f"이미지 생성 도쀑 μ˜ˆμ™Έ λ°œμƒ: {str(e)}")
80
 
 
 
 
 
 
 
81
  async def initiate_conversation(prompt, image_path, message):
82
  logging.debug(f'λŒ€ν™” μ‹œμž‘ 쀑: {prompt}')
83
  description = "μƒμ„±λœ μ΄λ―Έμ§€μž…λ‹ˆλ‹€."