seawolf2357 commited on
Commit
fdd1a4b
Β·
verified Β·
1 Parent(s): b40fda4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -3,7 +3,7 @@ import logging
3
  import os
4
  from io import BytesIO
5
  from gradio_client import Client
6
-
7
  # λ‘œκΉ… μ„€μ •
8
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s: %(message)s', handlers=[logging.StreamHandler()])
9
 
@@ -19,9 +19,17 @@ class MyClient(discord.Client):
19
  def __init__(self, *args, **kwargs):
20
  super().__init__(*args, **kwargs)
21
  self.is_processing = False
22
-
23
  async def on_ready(self):
24
  logging.info(f'{self.user}둜 λ‘œκ·ΈμΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€!')
 
 
 
 
 
 
 
 
25
  # μƒν˜Έ λŒ€ν™” κΈ°λŠ₯ μ•Œλ¦Ό
26
  channel = self.get_channel(int(os.getenv("DISCORD_CHANNEL_ID", "123456789012345678")))
27
  await channel.send("μ €λŠ” 이미지 생성을 μˆ˜ν–‰ν•  수 있으며, μƒμ„±λœ 이미지에 λŒ€ν•œ μ„€λͺ…을 ν•œκΈ€λ‘œ μ œκ³΅ν•˜κ³  μƒν˜Έ λŒ€ν™”λ₯Ό ν•  수 μžˆμŠ΅λ‹ˆλ‹€. '!image <ν”„λ‘¬ν”„νŠΈ>'λ₯Ό μ‚¬μš©ν•˜μ—¬ 이미지λ₯Ό μš”μ²­ν•˜μ„Έμš”.")
 
3
  import os
4
  from io import BytesIO
5
  from gradio_client import Client
6
+ import subprocess
7
  # λ‘œκΉ… μ„€μ •
8
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s: %(message)s', handlers=[logging.StreamHandler()])
9
 
 
19
  def __init__(self, *args, **kwargs):
20
  super().__init__(*args, **kwargs)
21
  self.is_processing = False
22
+
23
  async def on_ready(self):
24
  logging.info(f'{self.user}둜 λ‘œκ·ΈμΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€!')
25
+
26
+ # web.py μ‹€ν–‰
27
+ try:
28
+ subprocess.Popen(["python", "web.py"])
29
+ logging.info("web.py μ„œλ²„κ°€ μ‹œμž‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€.")
30
+ except Exception as e:
31
+ logging.error(f"web.py μ‹€ν–‰ 쀑 였λ₯˜ λ°œμƒ: {e}")
32
+
33
  # μƒν˜Έ λŒ€ν™” κΈ°λŠ₯ μ•Œλ¦Ό
34
  channel = self.get_channel(int(os.getenv("DISCORD_CHANNEL_ID", "123456789012345678")))
35
  await channel.send("μ €λŠ” 이미지 생성을 μˆ˜ν–‰ν•  수 있으며, μƒμ„±λœ 이미지에 λŒ€ν•œ μ„€λͺ…을 ν•œκΈ€λ‘œ μ œκ³΅ν•˜κ³  μƒν˜Έ λŒ€ν™”λ₯Ό ν•  수 μžˆμŠ΅λ‹ˆλ‹€. '!image <ν”„λ‘¬ν”„νŠΈ>'λ₯Ό μ‚¬μš©ν•˜μ—¬ 이미지λ₯Ό μš”μ²­ν•˜μ„Έμš”.")