Spaces:
Runtime error
Runtime error
seawolf2357
commited on
Commit
โข
99d9aea
1
Parent(s):
9113f54
Update app.py
Browse files
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 |
from dotenv import load_dotenv
|
13 |
|
14 |
# .env ํ์ผ์์ ํ๊ฒฝ ๋ณ์ ๋ก๋
|
@@ -24,17 +23,20 @@ intents.message_content = True
|
|
24 |
# ๋ฒ์ญ ํ์ดํ๋ผ์ธ ์ค์
|
25 |
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
26 |
|
27 |
-
# ํ๊ฒฝ ๋ณ์์์ ์ง์ ๋ ์ฑ๋ ID
|
28 |
-
TARGET_CHANNEL_ID = os.getenv('DISCORD_CHANNEL_ID')
|
29 |
|
30 |
# ๊ณ ์ ๋ ๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ
|
31 |
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"
|
32 |
|
33 |
-
# ๋๋ฐ์ด์ค ์ค์
|
34 |
-
device = "
|
35 |
|
36 |
-
#
|
37 |
-
|
|
|
|
|
|
|
38 |
pipeline = pipeline.to(device)
|
39 |
|
40 |
# ํ๋กฌํํธ ๋ฒ์ญ ํจ์
|
@@ -99,3 +101,4 @@ if __name__ == "__main__":
|
|
99 |
discord_client = MyClient(intents=intents)
|
100 |
discord_client.run(discord_token)
|
101 |
|
|
|
|
8 |
from diffusers import DiffusionPipeline
|
9 |
import io
|
10 |
from PIL import Image
|
|
|
11 |
from dotenv import load_dotenv
|
12 |
|
13 |
# .env ํ์ผ์์ ํ๊ฒฝ ๋ณ์ ๋ก๋
|
|
|
23 |
# ๋ฒ์ญ ํ์ดํ๋ผ์ธ ์ค์
|
24 |
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
25 |
|
26 |
+
# ํ๊ฒฝ ๋ณ์์์ ์ง์ ๋ ์ฑ๋ ID ๊ฐ์ ธ์ค๊ธฐ
|
27 |
+
TARGET_CHANNEL_ID = int(os.getenv('DISCORD_CHANNEL_ID')) # ์ฑ๋ ID๋ ์ ์ํ์ด์ด์ผ ํจ
|
28 |
|
29 |
# ๊ณ ์ ๋ ๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ
|
30 |
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"
|
31 |
|
32 |
+
# ๋๋ฐ์ด์ค ์ค์ (CPU ์ฌ์ฉ)
|
33 |
+
device = "cpu"
|
34 |
|
35 |
+
# Hugging Face ์ธ์ฆ
|
36 |
+
hf_token = os.getenv('HF_TOKEN')
|
37 |
+
|
38 |
+
# ์ด๋ฏธ์ง ์์ฑ ํ์ดํ๋ผ์ธ ์ค์ (CPU ์ฌ์ฉ ๋ฐ Hugging Face ํ ํฐ ์ฌ์ฉ)
|
39 |
+
pipeline = DiffusionPipeline.from_pretrained("fluently/Fluently-XL-Final", torch_dtype=torch.float32, use_auth_token=hf_token)
|
40 |
pipeline = pipeline.to(device)
|
41 |
|
42 |
# ํ๋กฌํํธ ๋ฒ์ญ ํจ์
|
|
|
101 |
discord_client = MyClient(intents=intents)
|
102 |
discord_client.run(discord_token)
|
103 |
|
104 |
+
|