qubvel-hf HF staff commited on
Commit
e5babce
1 Parent(s): 2a83ac5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -245,7 +245,11 @@ def update_augmented_images(image, code):
245
  if "=," in code:
246
  raise gr.Error("You have to fill in some parameters to apply transform!")
247
 
248
- augmentation = eval(code)
 
 
 
 
249
  track_event("transform_applied", properties={"transform_name": augmentation.__class__.__name__, "code": code})
250
 
251
  compose = A.Compose(
 
245
  if "=," in code:
246
  raise gr.Error("You have to fill in some parameters to apply transform!")
247
 
248
+ try:
249
+ augmentation = eval(code)
250
+ except ValidationError as e:
251
+ gr.Error(str(e))
252
+
253
  track_event("transform_applied", properties={"transform_name": augmentation.__class__.__name__, "code": code})
254
 
255
  compose = A.Compose(