doevent commited on
Commit
b54a771
1 Parent(s): eeeffa9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -19,9 +19,6 @@ def inference(image, size):
19
  if image is None:
20
  raise gr.Error("Image not uploaded")
21
 
22
- width, height = image.size
23
- if width >= 5000 or height >= 5000:
24
- raise gr.Error("The image is too large.")
25
 
26
  if torch.cuda.is_available():
27
  torch.cuda.empty_cache()
@@ -44,6 +41,9 @@ def inference(image, size):
44
  result = model2.predict(image.convert('RGB'))
45
  else:
46
  try:
 
 
 
47
  result = model8.predict(image.convert('RGB'))
48
  except torch.cuda.OutOfMemoryError as e:
49
  print(e)
 
19
  if image is None:
20
  raise gr.Error("Image not uploaded")
21
 
 
 
 
22
 
23
  if torch.cuda.is_available():
24
  torch.cuda.empty_cache()
 
41
  result = model2.predict(image.convert('RGB'))
42
  else:
43
  try:
44
+ width, height = image.size
45
+ if width >= 5000 or height >= 5000:
46
+ raise gr.Error("The image is too large.")
47
  result = model8.predict(image.convert('RGB'))
48
  except torch.cuda.OutOfMemoryError as e:
49
  print(e)