Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -6,16 +6,13 @@ import spaces
|
|
6 |
import torch
|
7 |
import torch.nn as nn
|
8 |
import torch.optim as optim
|
|
|
9 |
import torchvision.transforms as transforms
|
10 |
import torchvision.models as models
|
11 |
import gradio as gr
|
12 |
from gradio_imageslider import ImageSlider
|
13 |
|
14 |
-
device = 'cpu'
|
15 |
-
if torch.backends.mps.is_available():
|
16 |
-
device = 'mps'
|
17 |
-
if torch.cuda.is_available():
|
18 |
-
device = 'cuda'
|
19 |
print('DEVICE:', device)
|
20 |
|
21 |
class VGG_19(nn.Module):
|
@@ -155,5 +152,5 @@ interface = gr.Interface(
|
|
155 |
['./content_images/Beach.jpg', 'Oil Painting'],
|
156 |
['./content_images/StandingOnCliff.png', 'Great Wave'],
|
157 |
],
|
158 |
-
cache_examples=
|
159 |
).launch(inbrowser=True)
|
|
|
6 |
import torch
|
7 |
import torch.nn as nn
|
8 |
import torch.optim as optim
|
9 |
+
import torch.amp as amp
|
10 |
import torchvision.transforms as transforms
|
11 |
import torchvision.models as models
|
12 |
import gradio as gr
|
13 |
from gradio_imageslider import ImageSlider
|
14 |
|
15 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
|
|
|
|
|
|
16 |
print('DEVICE:', device)
|
17 |
|
18 |
class VGG_19(nn.Module):
|
|
|
152 |
['./content_images/Beach.jpg', 'Oil Painting'],
|
153 |
['./content_images/StandingOnCliff.png', 'Great Wave'],
|
154 |
],
|
155 |
+
cache_examples='lazy'
|
156 |
).launch(inbrowser=True)
|