Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import uuid
|
|
5 |
import torch
|
6 |
import subprocess
|
7 |
from huggingface_hub import snapshot_download
|
8 |
-
from diffusers import
|
9 |
from transformers import pipeline
|
10 |
|
11 |
# ๋ก๊น
์ค์
|
@@ -19,9 +19,7 @@ intents.message_content = True
|
|
19 |
huggingface_token = os.getenv("HF_TOKEN")
|
20 |
model_path = snapshot_download(
|
21 |
repo_id="Corcelio/mobius",
|
22 |
-
revision="refs/pr/26",
|
23 |
repo_type="model",
|
24 |
-
ignore_patterns=[".md", "..gitattributes"],
|
25 |
local_dir="mobius",
|
26 |
token=huggingface_token,
|
27 |
)
|
@@ -30,9 +28,9 @@ model_path = snapshot_download(
|
|
30 |
def load_pipeline(pipeline_type):
|
31 |
logging.debug(f'ํ์ดํ๋ผ์ธ ๋ก๋ ์ค: {pipeline_type}')
|
32 |
if pipeline_type == "text2img":
|
33 |
-
return
|
34 |
elif pipeline_type == "img2img":
|
35 |
-
return
|
36 |
|
37 |
# ๋๋ฐ์ด์ค ์ค์
|
38 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
|
5 |
import torch
|
6 |
import subprocess
|
7 |
from huggingface_hub import snapshot_download
|
8 |
+
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
|
9 |
from transformers import pipeline
|
10 |
|
11 |
# ๋ก๊น
์ค์
|
|
|
19 |
huggingface_token = os.getenv("HF_TOKEN")
|
20 |
model_path = snapshot_download(
|
21 |
repo_id="Corcelio/mobius",
|
|
|
22 |
repo_type="model",
|
|
|
23 |
local_dir="mobius",
|
24 |
token=huggingface_token,
|
25 |
)
|
|
|
28 |
def load_pipeline(pipeline_type):
|
29 |
logging.debug(f'ํ์ดํ๋ผ์ธ ๋ก๋ ์ค: {pipeline_type}')
|
30 |
if pipeline_type == "text2img":
|
31 |
+
return StableDiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float16, use_fast=True)
|
32 |
elif pipeline_type == "img2img":
|
33 |
+
return StableDiffusionImg2ImgPipeline.from_pretrained(model_path, torch_dtype=torch.float16, use_fast=True)
|
34 |
|
35 |
# ๋๋ฐ์ด์ค ์ค์
|
36 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|