doevent commited on
Commit
1c169bd
1 Parent(s): 063e58f
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -13,12 +13,16 @@ model8.load_weights('weights/RealESRGAN_x8.pth', download=True)
13
 
14
 
15
  def inference(image: Image, size: str) -> Image:
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
  return result
23
 
24
 
 
13
 
14
 
15
  def inference(image: Image, size: str) -> Image:
16
+ try:
17
+ if size == '2x':
18
+ result = model2.predict(image.convert('RGB'))
19
+ elif size == '4x':
20
+ result = model4.predict(image.convert('RGB'))
21
+ else:
22
+ result = model8.predict(image.convert('RGB'))
23
+ except Exception as e:
24
+ print(e)
25
+ raise gr.Error(str(e))
26
  return result
27
 
28