Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,9 +8,20 @@ from huggingface_hub import hf_hub_download
|
|
| 8 |
import torch
|
| 9 |
import os
|
| 10 |
from PIL import Image, ImageFilter, ImageOps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
if torch.cuda.is_available():
|
| 15 |
torch_dtype = torch.float16
|
| 16 |
else:
|
|
|
|
| 8 |
import torch
|
| 9 |
import os
|
| 10 |
from PIL import Image, ImageFilter, ImageOps
|
| 11 |
+
from huggingface_hub import login, hf_hub_download
|
| 12 |
+
import os
|
| 13 |
+
|
| 14 |
+
# Log in to Hugging Face for private repo access
|
| 15 |
+
if "HF_TOKEN" in os.environ:
|
| 16 |
+
login(os.environ["HF_TOKEN"])
|
| 17 |
+
else:
|
| 18 |
+
raise ValueError("HF_TOKEN not found in environment variables. Please set it in Space settings.")
|
| 19 |
|
| 20 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 21 |
+
# Download the private model file
|
| 22 |
+
repo_id = "DreamingOracle/Quagmaform_alpha-1" # Your private repo
|
| 23 |
+
filename = "DPS_Quagmaform_Alpha1.safetensors" # Your model file
|
| 24 |
+
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
| 25 |
if torch.cuda.is_available():
|
| 26 |
torch_dtype = torch.float16
|
| 27 |
else:
|