Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,16 +5,36 @@ from typing import Sequence, Mapping, Any, Union
|
|
| 5 |
import torch
|
| 6 |
import gradio as gr
|
| 7 |
from PIL import Image
|
| 8 |
-
from huggingface_hub import hf_hub_download
|
| 9 |
import spaces
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Import all the necessary functions from the original script
|
| 20 |
def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
|
|
|
|
| 5 |
import torch
|
| 6 |
import gradio as gr
|
| 7 |
from PIL import Image
|
| 8 |
+
from huggingface_hub import hf_hub_download, login
|
| 9 |
import spaces
|
| 10 |
|
| 11 |
+
# Hugging Face 토큰으로 로그인
|
| 12 |
+
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 13 |
+
if HF_TOKEN is None:
|
| 14 |
+
raise ValueError("Please set the HF_TOKEN environment variable")
|
| 15 |
+
login(token=HF_TOKEN)
|
| 16 |
+
|
| 17 |
+
# 이후 모델 다운로드
|
| 18 |
+
hf_hub_download(
|
| 19 |
+
repo_id="black-forest-labs/FLUX.1-Redux-dev",
|
| 20 |
+
filename="flux1-redux-dev.safetensors",
|
| 21 |
+
local_dir="models/style_models",
|
| 22 |
+
token=HF_TOKEN # 토큰 전달
|
| 23 |
+
)
|
| 24 |
+
hf_hub_download(
|
| 25 |
+
repo_id="black-forest-labs/FLUX.1-Depth-dev",
|
| 26 |
+
filename="flux1-depth-dev.safetensors",
|
| 27 |
+
local_dir="models/diffusion_models",
|
| 28 |
+
token=HF_TOKEN
|
| 29 |
+
)
|
| 30 |
+
# 나머지 hf_hub_download 호출에도 token=HF_TOKEN 추가
|
| 31 |
+
hf_hub_download(repo_id="Comfy-Org/sigclip_vision_384", filename="sigclip_vision_patch14_384.safetensors", local_dir="models/clip_vision", token=HF_TOKEN)
|
| 32 |
+
hf_hub_download(repo_id="Kijai/DepthAnythingV2-safetensors", filename="depth_anything_v2_vitl_fp32.safetensors", local_dir="models/depthanything", token=HF_TOKEN)
|
| 33 |
+
hf_hub_download(repo_id="black-forest-labs/FLUX.1-dev", filename="ae.safetensors", local_dir="models/vae/FLUX1", token=HF_TOKEN)
|
| 34 |
+
hf_hub_download(repo_id="comfyanonymous/flux_text_encoders", filename="clip_l.safetensors", local_dir="models/text_encoders", token=HF_TOKEN)
|
| 35 |
+
t5_path = hf_hub_download(repo_id="comfyanonymous/flux_text_encoders", filename="t5xxl_fp16.safetensors", local_dir="models/text_encoders/t5", token=HF_TOKEN)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
|
| 39 |
# Import all the necessary functions from the original script
|
| 40 |
def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
|