doevent commited on
Commit
7f5a3aa
1 Parent(s): db089ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -13,6 +13,9 @@ model8.load_weights('weights/RealESRGAN_x8.pth', download=True)
13
 
14
 
15
  def inference(image, size):
 
 
 
16
  if torch.cuda.is_available():
17
  torch.cuda.empty_cache()
18
 
@@ -22,7 +25,7 @@ def inference(image, size):
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
 
28
 
 
13
 
14
 
15
  def inference(image, size):
16
+ if image is None:
17
+ raise gr.Error("Image not uploaded")
18
+
19
  if torch.cuda.is_available():
20
  torch.cuda.empty_cache()
21
 
 
25
  result = model4.predict(image.convert('RGB'))
26
  else:
27
  result = model8.predict(image.convert('RGB'))
28
+ print(f"Image size ({device}): {size} ... OK")
29
  return result
30
 
31