Spaces:
Runtime error
Runtime error
cocktailpeanut
commited on
Commit
·
44f737a
1
Parent(s):
56839e6
update
Browse files- app.py +5 -3
- requirements.txt +2 -2
app.py
CHANGED
@@ -5,6 +5,8 @@ from PIL import Image
|
|
5 |
import numpy as np
|
6 |
from aura_sr import AuraSR
|
7 |
import torch
|
|
|
|
|
8 |
|
9 |
# Force CPU usage
|
10 |
torch.set_default_tensor_type(torch.FloatTensor)
|
@@ -14,7 +16,7 @@ original_load = torch.load
|
|
14 |
torch.load = lambda *args, **kwargs: original_load(*args, **kwargs, map_location=torch.device('cpu'))
|
15 |
|
16 |
# Initialize the AuraSR model
|
17 |
-
aura_sr = AuraSR.from_pretrained("fal/AuraSR-v2")
|
18 |
|
19 |
# Restore original torch.load
|
20 |
torch.load = original_load
|
@@ -72,7 +74,7 @@ with gr.Blocks() as demo:
|
|
72 |
inputs=input_image,
|
73 |
outputs=output_slider,
|
74 |
fn=process_image,
|
75 |
-
cache_examples=True
|
76 |
)
|
77 |
|
78 |
-
demo.launch(debug=True)
|
|
|
5 |
import numpy as np
|
6 |
from aura_sr import AuraSR
|
7 |
import torch
|
8 |
+
import devicetorch
|
9 |
+
DEVICE = devicetorch.get(torch)
|
10 |
|
11 |
# Force CPU usage
|
12 |
torch.set_default_tensor_type(torch.FloatTensor)
|
|
|
16 |
torch.load = lambda *args, **kwargs: original_load(*args, **kwargs, map_location=torch.device('cpu'))
|
17 |
|
18 |
# Initialize the AuraSR model
|
19 |
+
aura_sr = AuraSR.from_pretrained("fal/AuraSR-v2", device=DEVICE)
|
20 |
|
21 |
# Restore original torch.load
|
22 |
torch.load = original_load
|
|
|
74 |
inputs=input_image,
|
75 |
outputs=output_slider,
|
76 |
fn=process_image,
|
77 |
+
# cache_examples=True
|
78 |
)
|
79 |
|
80 |
+
demo.launch(debug=True)
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
spaces
|
2 |
-
aura-sr
|
3 |
-
gradio-imageslider
|
|
|
1 |
spaces
|
2 |
+
aura-sr@git+https://github.com/cocktailpeanut/aura-sr.git
|
3 |
+
gradio-imageslider
|