gera-richarte commited on
Commit
db4eaac
·
1 Parent(s): d91013d

Report error if "Next Batch" is clicked before Load Dataset... I could rather disable/enable the button... next life

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -38,7 +38,10 @@ def open_dataset(dataset, subset, split, batch_size, shard, only_rgb, state):
38
  )
39
 
40
  def get_images(batch_size, only_rgb, state):
41
- subset = state["subset"]
 
 
 
42
 
43
  images = []
44
  metadatas = []
 
38
  )
39
 
40
  def get_images(batch_size, only_rgb, state):
41
+ try:
42
+ subset = state["subset"]
43
+ except KeyError:
44
+ raise gr.Error("You need to load a Dataset first")
45
 
46
  images = []
47
  metadatas = []