Spaces:
Running
on
Zero
Running
on
Zero
NIRVANALAN
commited on
Commit
·
27ff067
1
Parent(s):
267d055
update
Browse files
app.py
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import torchvision
|
| 3 |
from torchvision import transforms
|
| 4 |
import numpy as np
|
| 5 |
|
| 6 |
import os
|
| 7 |
-
from omegaconf import OmegaConf
|
| 8 |
from PIL import Image
|
| 9 |
-
|
| 10 |
-
import gradio as gr
|
| 11 |
-
|
| 12 |
import rembg
|
| 13 |
|
| 14 |
-
import spaces
|
| 15 |
|
| 16 |
from huggingface_hub import hf_hub_download
|
| 17 |
|
|
@@ -454,4 +451,14 @@ if __name__ == "__main__":
|
|
| 454 |
|
| 455 |
args.rendering_kwargs = rendering_options_defaults(args)
|
| 456 |
|
| 457 |
-
main(args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import spaces
|
| 3 |
import torch
|
| 4 |
import torchvision
|
| 5 |
from torchvision import transforms
|
| 6 |
import numpy as np
|
| 7 |
|
| 8 |
import os
|
|
|
|
| 9 |
from PIL import Image
|
|
|
|
|
|
|
|
|
|
| 10 |
import rembg
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
from huggingface_hub import hf_hub_download
|
| 14 |
|
|
|
|
| 451 |
|
| 452 |
args.rendering_kwargs = rendering_options_defaults(args)
|
| 453 |
|
| 454 |
+
# main(args)
|
| 455 |
+
|
| 456 |
+
zero = torch.Tensor([0]).cuda()
|
| 457 |
+
print(zero.device) # <-- 'cpu' 🤔
|
| 458 |
+
|
| 459 |
+
@spaces.GPU
|
| 460 |
+
def greet(n):
|
| 461 |
+
print(zero.device) # <-- 'cuda:0' 🤗
|
| 462 |
+
return f"Hello {zero + n} Tensor"
|
| 463 |
+
|
| 464 |
+
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
|