Spaces:
Running
on
Zero
Running
on
Zero
NIRVANALAN
commited on
Commit
·
59a6cfe
1
Parent(s):
14eb356
update
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import spaces
|
|
|
|
| 3 |
import torch
|
| 4 |
import torchvision
|
| 5 |
from torchvision import transforms
|
|
@@ -66,6 +67,14 @@ from utils.infer_utils import remove_background, resize_foreground
|
|
| 66 |
|
| 67 |
SEED = 0
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
def resize_to_224(img):
|
| 70 |
img = transforms.functional.resize(img, 224,
|
| 71 |
interpolation=transforms.InterpolationMode.LANCZOS)
|
|
@@ -451,6 +460,8 @@ if __name__ == "__main__":
|
|
| 451 |
|
| 452 |
args.rendering_kwargs = rendering_options_defaults(args)
|
| 453 |
|
|
|
|
|
|
|
| 454 |
# main(args)
|
| 455 |
|
| 456 |
zero = torch.Tensor([0]).cuda()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import spaces
|
| 3 |
+
import subprocess
|
| 4 |
import torch
|
| 5 |
import torchvision
|
| 6 |
from torchvision import transforms
|
|
|
|
| 67 |
|
| 68 |
SEED = 0
|
| 69 |
|
| 70 |
+
def install_dependency():
|
| 71 |
+
# install apex
|
| 72 |
+
subprocess.run(
|
| 73 |
+
f'{sys.executable} -m pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git@https://github.com/NVIDIA/apex.git',
|
| 74 |
+
shell=True,
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
def resize_to_224(img):
|
| 79 |
img = transforms.functional.resize(img, 224,
|
| 80 |
interpolation=transforms.InterpolationMode.LANCZOS)
|
|
|
|
| 460 |
|
| 461 |
args.rendering_kwargs = rendering_options_defaults(args)
|
| 462 |
|
| 463 |
+
install_dependency()
|
| 464 |
+
|
| 465 |
# main(args)
|
| 466 |
|
| 467 |
zero = torch.Tensor([0]).cuda()
|