Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,38 +15,6 @@ from inpainting import StableDiffusionInpaintingPipeline
|
|
| 15 |
from torchvision import transforms
|
| 16 |
from clipseg.models.clipseg import CLIPDensePredT
|
| 17 |
|
| 18 |
-
#from huggingface_hub import hf_hub_download
|
| 19 |
-
#hf_hub_download(repo_id="ThereforeGames/txt2mask", filename="/repositories/clipseg/")
|
| 20 |
-
#clone_from (str, optional) — Either a repository url or repo_id. Example:
|
| 21 |
-
#api = HfApi()
|
| 22 |
-
|
| 23 |
-
#from huggingface_hub import Repository
|
| 24 |
-
#with Repository(local_dir="clipseg", clone_from="ThereforeGames/txt2mask/repositories/clipseg/")
|
| 25 |
-
"""
|
| 26 |
-
import sys
|
| 27 |
-
import os
|
| 28 |
-
|
| 29 |
-
from zipfile import ZipFile
|
| 30 |
-
zf = ZipFile('clipseg-master.zip', 'r')
|
| 31 |
-
zf.extractall('./clipseg')
|
| 32 |
-
zf.close()
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
from huggingface_hub import HfApi
|
| 36 |
-
api = HfApi()
|
| 37 |
-
api.upload_folder(
|
| 38 |
-
folder_path="/",
|
| 39 |
-
path_in_repo="ThereforeGames/txt2mask/repositories/clipseg/",
|
| 40 |
-
repo_id="ThereforeGames/txt2mask",
|
| 41 |
-
# repo_type="dataset",
|
| 42 |
-
# ignore_patterns="**/logs/*.txt",
|
| 43 |
-
)
|
| 44 |
-
"""
|
| 45 |
-
#.commit(commit_message="clipseg uploaded...")
|
| 46 |
-
# with open("file.txt", "w+") as f:
|
| 47 |
-
# f.write(json.dumps({"hey": 8}))
|
| 48 |
-
|
| 49 |
-
|
| 50 |
auth_token = os.environ.get("API_TOKEN") or True
|
| 51 |
|
| 52 |
def download_image(url):
|
|
@@ -63,7 +31,7 @@ model_id_or_path = "CompVis/stable-diffusion-v1-4"
|
|
| 63 |
pipe = StableDiffusionInpaintingPipeline.from_pretrained(
|
| 64 |
model_id_or_path,
|
| 65 |
revision="fp16",
|
| 66 |
-
torch_dtype=torch.
|
| 67 |
use_auth_token=auth_token
|
| 68 |
).to(device)
|
| 69 |
#pipe = pipe.to(device)
|
|
|
|
| 15 |
from torchvision import transforms
|
| 16 |
from clipseg.models.clipseg import CLIPDensePredT
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
auth_token = os.environ.get("API_TOKEN") or True
|
| 19 |
|
| 20 |
def download_image(url):
|
|
|
|
| 31 |
pipe = StableDiffusionInpaintingPipeline.from_pretrained(
|
| 32 |
model_id_or_path,
|
| 33 |
revision="fp16",
|
| 34 |
+
torch_dtype=torch.double,
|
| 35 |
use_auth_token=auth_token
|
| 36 |
).to(device)
|
| 37 |
#pipe = pipe.to(device)
|