Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from PIL import Image
|
|
3 |
from RealESRGAN import RealESRGAN
|
4 |
import gradio as gr
|
5 |
import gc
|
|
|
6 |
|
7 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
8 |
model2 = RealESRGAN(device, scale=2)
|
@@ -16,6 +17,8 @@ if torch.cuda.is_available():
|
|
16 |
torch.cuda.empty_cache()
|
17 |
gc.collect()
|
18 |
|
|
|
|
|
19 |
def inference(image, size):
|
20 |
if image is None:
|
21 |
raise gr.Error("Image not uploaded")
|
|
|
3 |
from RealESRGAN import RealESRGAN
|
4 |
import gradio as gr
|
5 |
import gc
|
6 |
+
import spaces
|
7 |
|
8 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
9 |
model2 = RealESRGAN(device, scale=2)
|
|
|
17 |
torch.cuda.empty_cache()
|
18 |
gc.collect()
|
19 |
|
20 |
+
|
21 |
+
@spaces.GPU
|
22 |
def inference(image, size):
|
23 |
if image is None:
|
24 |
raise gr.Error("Image not uploaded")
|