Update app.py
Browse files
app.py
CHANGED
@@ -13,14 +13,15 @@ model8.load_weights('weights/RealESRGAN_x8.pth', download=True)
|
|
13 |
|
14 |
|
15 |
def inference(image, size):
|
|
|
|
|
|
|
16 |
if size == '2x':
|
17 |
result = model2.predict(image.convert('RGB'))
|
18 |
elif size == '4x':
|
19 |
result = model4.predict(image.convert('RGB'))
|
20 |
else:
|
21 |
result = model8.predict(image.convert('RGB'))
|
22 |
-
if torch.cuda.is_available():
|
23 |
-
torch.cuda.empty_cache()
|
24 |
print(f"Image size: {size} ... OK")
|
25 |
return result
|
26 |
|
|
|
13 |
|
14 |
|
15 |
def inference(image, size):
|
16 |
+
if torch.cuda.is_available():
|
17 |
+
torch.cuda.empty_cache()
|
18 |
+
|
19 |
if size == '2x':
|
20 |
result = model2.predict(image.convert('RGB'))
|
21 |
elif size == '4x':
|
22 |
result = model4.predict(image.convert('RGB'))
|
23 |
else:
|
24 |
result = model8.predict(image.convert('RGB'))
|
|
|
|
|
25 |
print(f"Image size: {size} ... OK")
|
26 |
return result
|
27 |
|